Skip to content

Commit

Permalink
feat(led): Update to allow configuration of the led sleep mode
Browse files Browse the repository at this point in the history
  • Loading branch information
finger563 committed Jan 10, 2025
1 parent 4ee42c8 commit 9c295a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/led/include/led.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ class Led : public BaseComponent {
ledc_mode_t speed_mode{
LEDC_LOW_SPEED_MODE}; /**< The LEDC speed mode you want for this LED channel. */
bool output_invert{false}; /**< Whether to invert the GPIO output for this LED channel. */
ledc_sleep_mode_t sleep_mode{
LEDC_SLEEP_MODE_KEEP_ALIVE}; /**< The LEDC sleep mode you want for this
LED channel. Default is
LEDC_SLEEP_MODE_KEEP_ALIVE which will
keep the LEDC output when the system
enters light sleep. Note that this is
only useful if the LED's clock_config is
set to a clock source which supports
light sleep. */
};

/**
Expand Down
1 change: 1 addition & 0 deletions components/led/src/led.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Led::Led(const Config &config) noexcept
channel_conf.duty = actual_duty;
channel_conf.gpio_num = conf.gpio;
channel_conf.speed_mode = conf.speed_mode;
channel_conf.sleep_mode = conf.sleep_mode;
channel_conf.hpoint = 0;
channel_conf.timer_sel = conf.timer;
channel_conf.flags.output_invert = conf.output_invert;
Expand Down

0 comments on commit 9c295a8

Please sign in to comment.