ISR handler — services only ISR-backend entries
| 112 | |
| 113 | // ISR handler — services only ISR-backend entries |
| 114 | void FL_IRAM pwm_isr_handler(void* user_data) { |
| 115 | (void)user_data; |
| 116 | PwmStateData& st = state(); |
| 117 | |
| 118 | for (u8 i = 0; i < MAX_PWM_CHANNELS; i++) { |
| 119 | PwmPinState& ch = st.channels[i]; |
| 120 | if (ch.pin < 0 || ch.backend != PwmBackend::IsrSoftware) continue; |
| 121 | |
| 122 | ch.tick_counter++; |
| 123 | |
| 124 | // Turn LOW at duty cycle boundary |
| 125 | if (ch.tick_counter == ch.high_ticks && ch.pin_state) { |
| 126 | fl::digitalWrite(ch.pin, fl::PinValue::Low); |
| 127 | ch.pin_state = false; |
| 128 | } |
| 129 | // Start new period: reset counter, turn HIGH if duty > 0 |
| 130 | else if (ch.tick_counter >= ch.period_ticks) { |
| 131 | ch.tick_counter = 0; |
| 132 | if (ch.high_ticks > 0) { |
| 133 | fl::digitalWrite(ch.pin, fl::PinValue::High); |
| 134 | ch.pin_state = true; |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | // Find channel by pin number |
| 141 | PwmPinState* findByPin(int pin) { |
nothing calls this directly
no test coverage detected