30#include "platforms/pin.h"
52 platforms::digitalWrite(pin, val);
56 return platforms::digitalRead(pin);
63 platforms::setAdcRange(range);
222 if (!ch || ch->pin < 0)
return;
230 ch->frequency_hz = 0;
248 u8 duty = (val > 255) ? 255 :
static_cast<u8>(val);
257 platforms::analogWrite(pin, val);
262 platforms::analogWrite(pin, val);
270 u8 duty =
static_cast<u8>(val >> 8);
278 platforms::setPwm16(pin, val);
283 platforms::setPwm16(pin, val);
301 if (frequency_hz == 0) {
302 FL_WARN(
"setPwmFrequency: Frequency must be > 0");
307 bool needs_isr = platforms::needsPwmIsrFallback(pin, frequency_hz);
311 int result = platforms::setPwmFrequencyNative(pin, frequency_hz);
313 FL_WARN(
"setPwmFrequency: Native backend failed: " <<
result);
346 if (isr_result != 0) {
377 return platforms::getPwmFrequencyNative(pin);
403 platforms::pinMode(pin, mode);
static T & instance() FL_NO_EXCEPT
RAII helper for critical sections (interrupt disable/enable) Automatically disables interrupts on con...
Umbrella header for ISR subsystem.
Centralized logging categories for FastLED hardware interfaces and subsystems.
constexpr u32 ISR_FLAG_IRAM_SAFE
const char * get_error_string(int error_code) FL_NO_EXCEPT
Get platform-specific error description.
int attach_timer_handler(const config &cfg, handle *out_handle) FL_NO_EXCEPT
Attach a timer-based ISR handler.
constexpr u8 ISR_PRIORITY_MEDIUM
int detach_handler(handle &h) FL_NO_EXCEPT
Detach an ISR handler.
void releaseChannel(PwmPinState *ch) FL_NO_EXCEPT
void FL_IRAM pwm_isr_handler(void *user_data) FL_NO_EXCEPT
constexpr u8 MAX_PWM_CHANNELS
constexpr u32 MAX_ISR_PWM_FREQUENCY
PwmStateData & state() FL_NO_EXCEPT
constexpr u32 ISR_FREQUENCY_HZ
int ensureIsrActive() FL_NO_EXCEPT
PwmPinState * findByPin(int pin) FL_NO_EXCEPT
void maybeShutdownIsr() FL_NO_EXCEPT
PwmPinState * allocate() FL_NO_EXCEPT
u8 countIsrChannels() FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
u32 getPwmFrequency(int pin) FL_NO_EXCEPT
Query the configured PWM frequency for a pin.
PinValue
Digital pin value.
@ Low
Logic low (0V / GND)
@ High
Logic high (3.3V / 5V, platform-dependent)
void setAdcRange(AdcRange range) FL_NO_EXCEPT
Set ADC voltage range.
AdcRange
ADC voltage range configuration.
expected< T, E > result
Alias for expected (Rust-style naming)
void analogWrite(int pin, u16 val) FL_NO_EXCEPT
Write analog value to pin (PWM)
int pwmEnd(int pin) FL_NO_EXCEPT
Release PWM channel and stop output on a pin.
int setPwmFrequency(int pin, u32 frequency_hz) FL_NO_EXCEPT
Set PWM frequency for a pin.
void digitalWrite(int pin, PinValue val) FL_NO_EXCEPT
Write digital value to pin.
PinValue digitalRead(int pin) FL_NO_EXCEPT
Read digital value from pin.
void setPwm16(int pin, u16 val) FL_NO_EXCEPT
Set PWM duty cycle with 16-bit resolution.
PinMode
Pin mode configuration.
@ Output
Digital output (push-pull)
void pinMode(int pin, PinMode mode) FL_NO_EXCEPT
Set pin mode (input, output, pull-up, pull-down)
Base definition for an LED controller.
Configuration for ISR attachment.
Opaque handle to an attached ISR.
PwmPinState() FL_NO_EXCEPT
PwmStateData() FL_NO_EXCEPT
fl::isr::handle isr_handle
PwmPinState channels[MAX_PWM_CHANNELS]