aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-ramping.h
diff options
context:
space:
mode:
authorGabriel Hart2021-08-12 11:15:48 -0500
committerGabriel Hart2021-08-12 11:15:48 -0500
commit1d3a4d7996ca5b046287f28db145eb3d09c9c495 (patch)
tree91aa3228f2781f9e43b2ee0f721778db9678ccce /spaghetti-monster/fsm-ramping.h
parentFinalized SP10S and renamed to SP10 Pro. Updated Sofirn settings to include SOS. (diff)
parentgot PFM / dynamic PWM actually working on Noctigon KR4 (diff)
downloadanduril-1d3a4d7996ca5b046287f28db145eb3d09c9c495.tar.gz
anduril-1d3a4d7996ca5b046287f28db145eb3d09c9c495.tar.bz2
anduril-1d3a4d7996ca5b046287f28db145eb3d09c9c495.zip
Merge updates from TKs main branch
Diffstat (limited to 'spaghetti-monster/fsm-ramping.h')
-rw-r--r--spaghetti-monster/fsm-ramping.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h
index 8fd89c7..d1ef6bc 100644
--- a/spaghetti-monster/fsm-ramping.h
+++ b/spaghetti-monster/fsm-ramping.h
@@ -53,7 +53,9 @@ void gradual_tick();
#define PWM_GET(x,y) pgm_read_byte(x+y)
#else
#define PWM_DATATYPE uint16_t
+#ifndef PWM_TOP
#define PWM_TOP 1023 // 10 bits by default
+#endif
// pointer plus 2*y bytes
//#define PWM_GET(x,y) pgm_read_word(x+(2*y))
// nope, the compiler was already doing the math correctly
@@ -74,6 +76,12 @@ PROGMEM const PWM_DATATYPE pwm3_levels[] = { PWM3_LEVELS };
PROGMEM const PWM_DATATYPE pwm4_levels[] = { PWM4_LEVELS };
#endif
+// pulse frequency modulation, a.k.a. dynamic PWM
+// (different ceiling / frequency at each ramp level)
+#ifdef USE_DYN_PWM
+PROGMEM const PWM_DATATYPE pwm_tops[] = { PWM_TOPS };
+#endif
+
// default / example ramps
#ifndef PWM1_LEVELS
#if PWM_CHANNELS == 1