From 73b67cccbe050be9e7e7ea671ffbbdd1d6f14f61 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 12 Aug 2021 05:32:51 -0600 Subject: 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) --- spaghetti-monster/fsm-ramping.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spaghetti-monster/fsm-ramping.h') 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 -- cgit v1.2.3