| 376 | // ============================================================================ |
| 377 | |
| 378 | void pinMode(int pin, PinMode mode) { |
| 379 | // Release any active PWM channel on this pin |
| 380 | // When pinMode is called, the pin's function is being changed, |
| 381 | // so any existing PWM configuration should be cleared |
| 382 | pwm_state::PwmPinState* ch = pwm_state::findByPin(pin); |
| 383 | if (ch) { |
| 384 | pwm_state::releaseChannel(ch); |
| 385 | } |
| 386 | |
| 387 | platforms::pinMode(pin, mode); |
| 388 | } |
| 389 | |
| 390 | } // namespace fl |