aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-ramping.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2021-08-12 05:32:51 -0600
committerSelene ToyKeeper2021-08-12 05:32:51 -0600
commit73b67cccbe050be9e7e7ea671ffbbdd1d6f14f61 (patch)
treef81c6bd9c835cf16d563c1b4436b6fe76c62e4c7 /spaghetti-monster/fsm-ramping.h
parentchanged Noctigon KR4 from fixed to dynamic PWM TOP value, for later use (diff)
downloadanduril-73b67cccbe050be9e7e7ea671ffbbdd1d6f14f61.tar.gz
anduril-73b67cccbe050be9e7e7ea671ffbbdd1d6f14f61.tar.bz2
anduril-73b67cccbe050be9e7e7ea671ffbbdd1d6f14f61.zip
got PFM / dynamic PWM actually working on Noctigon KR4
(and also added "jump start moon" to it) (and generally finished adding dynamic PWM support to FSM)
Diffstat (limited to '')
-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