aboutsummaryrefslogtreecommitdiff
path: root/hwdef-noctigon-m44.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-10-28 07:02:38 -0600
committerSelene ToyKeeper2023-10-28 07:02:38 -0600
commitaaa760e5243cf87a43297945b20e41a448c906e4 (patch)
treea29f30ceeeedf5573be58e43d486f8ec393f3657 /hwdef-noctigon-m44.c
parentenabled smooth steps on blf-q8 and sofirn-sp36, instead of tactical mode (diff)
downloadanduril-aaa760e5243cf87a43297945b20e41a448c906e4.tar.gz
anduril-aaa760e5243cf87a43297945b20e41a448c906e4.tar.bz2
anduril-aaa760e5243cf87a43297945b20e41a448c906e4.zip
switched blf-lt1-t1616 from plain PWM to PWM+DSM
(and made DSM interrupt definitions a bit cleaner)
Diffstat (limited to 'hwdef-noctigon-m44.c')
-rw-r--r--hwdef-noctigon-m44.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hwdef-noctigon-m44.c b/hwdef-noctigon-m44.c
index 0b7f027..395a7a2 100644
--- a/hwdef-noctigon-m44.c
+++ b/hwdef-noctigon-m44.c
@@ -52,9 +52,9 @@ Channel channels[] = {
void set_level_zero() {
- // disable timer 1 overflow interrupt
+ // disable timer overflow interrupt
// (helps improve button press handling from Off state)
- TIMSK &= ~(1 << TOIE1);
+ DSM_INTCTRL &= ~DSM_OVF_bm;
// turn off all LEDs
ch1_dsm_lvl = 0;
@@ -120,19 +120,19 @@ void set_hw_levels(PWM_DATATYPE ch1, PWM_DATATYPE ch2,
PWM_TOP = top;
#endif
- // enable timer 1 overflow interrupt so DSM can work
- TIMSK |= (1 << TOIE1);
+ // enable timer overflow interrupt so DSM can work
+ DSM_INTCTRL |= DSM_OVF_bm;
- // reset phase when turning on or off
+ // reset phase when turning on
//if ((! was_on) | (! now_on)) PWM_CNT = 0;
if (! was_on) PWM_CNT = 0;
}
// delta-sigma modulation of PWM outputs
-// happens on each Timer0 overflow (every 512 cpu clock cycles)
+// happens on each Timer overflow (every 512 cpu clock cycles)
// uses 8-bit pwm w/ 7-bit dsm (0b 0PPP PPPP PDDD DDDD)
-ISR(TIMER1_OVF_vect) {
+ISR(DSM_vect) {
// set new hardware values first,
// for best timing (reduce effect of interrupt jitter)
CH1_PWM = ch1_pwm;