aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-main.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2022-04-09 02:46:15 -0600
committerSelene ToyKeeper2022-04-09 02:46:15 -0600
commit3a0f2bb9fa050bf9a0e8dd38cf32d316e1b18f56 (patch)
tree0bfc60c84622b2b23593a76e6dae2d94ad8078be /spaghetti-monster/fsm-main.c
parentk9.3 tint-toggle build is broken, generate a better fail error (until it's fi... (diff)
parentmerged anduril2 branch for upstream changes (diff)
downloadanduril-3a0f2bb9fa050bf9a0e8dd38cf32d316e1b18f56.tar.gz
anduril-3a0f2bb9fa050bf9a0e8dd38cf32d316e1b18f56.tar.bz2
anduril-3a0f2bb9fa050bf9a0e8dd38cf32d316e1b18f56.zip
merged sofirn sp10-pro branch (should have done it months ago, but forgot)
Diffstat (limited to 'spaghetti-monster/fsm-main.c')
-rw-r--r--spaghetti-monster/fsm-main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-main.c b/spaghetti-monster/fsm-main.c
index 7031009..30b8a67 100644
--- a/spaghetti-monster/fsm-main.c
+++ b/spaghetti-monster/fsm-main.c
@@ -46,19 +46,30 @@ static inline void hw_setup() {
DDRB |= (1 << PWM1_PIN);
TCCR0B = 0x01; // pre-scaler for timer (1 => 1, 2 => 8, 3 => 64...)
TCCR0A = PHASE;
+ #if (PWM1_PIN == PB4) // Second PWM counter is ... weird
+ TCCR1 = _BV (CS10);
+ GTCCR = _BV (COM1B1) | _BV (PWM1B);
+ OCR1C = 255; // Set ceiling value to maximum
+ #endif
#endif
// tint ramping needs second channel enabled,
// despite PWM_CHANNELS being only 1
#if (PWM_CHANNELS >= 2) || defined(USE_TINT_RAMPING)
DDRB |= (1 << PWM2_PIN);
+ #if (PWM2_PIN == PB4) // Second PWM counter is ... weird
+ TCCR1 = _BV (CS10);
+ GTCCR = _BV (COM1B1) | _BV (PWM1B);
+ OCR1C = 255; // Set ceiling value to maximum
+ #endif
#endif
#if PWM_CHANNELS >= 3
- // Second PWM counter is ... weird
DDRB |= (1 << PWM3_PIN);
+ #if (PWM3_PIN == PB4) // Second PWM counter is ... weird
TCCR1 = _BV (CS10);
GTCCR = _BV (COM1B1) | _BV (PWM1B);
OCR1C = 255; // Set ceiling value to maximum
#endif
+ #endif
#if PWM_CHANNELS >= 4
// 4th PWM channel is ... not actually supported in hardware :(
DDRB |= (1 << PWM4_PIN);