ChaosDMX
Open-Source DMX-Interface
Loading...
Searching...
No Matches
led.h File Reference

LED control component with flexible blinking and breathing modes. More...

#include "driver/ledc.h"
#include "esp_err.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "freertos/task.h"
#include "logger.h"
#include <math.h>
#include <stdint.h>
Include dependency graph for led.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  led_mode_t {
  LED_MODE_OFF , LED_MODE_BOOT_BREATHING , LED_MODE_RESET , LED_MODE_NORMAL ,
  LED_MODE_WARN , LED_MODE_ERROR
}
 Available operational modes for the status LED. More...

Functions

esp_err_t led_init (void)
 Initializes the LEDC peripheral for the status LED.
void led_set_mode (led_mode_t mode)
 Sets the current operational mode of the LED.
void led_set_brightness (uint8_t brightness)
 Dynamically updates the LED maximum brightness.

Detailed Description

LED control component with flexible blinking and breathing modes.

Definition in file led.h.

Enumeration Type Documentation

◆ led_mode_t

enum led_mode_t

Available operational modes for the status LED.

Enumerator
LED_MODE_OFF 

LED turned off

LED_MODE_BOOT_BREATHING 

Smooth fading/pulsing for startup

LED_MODE_RESET 

Fast pulsing for resetting

LED_MODE_NORMAL 

Constant solid light

LED_MODE_WARN 

Slow blinking

LED_MODE_ERROR 

Fast blinking

Definition at line 24 of file led.h.

Function Documentation

◆ led_init()

esp_err_t led_init ( void )

Initializes the LEDC peripheral for the status LED.

Sets up the timer and channel configuration for the LED GPIO.

Returns
ESP_OK on success, or an error code from the LEDC driver.

Definition at line 117 of file led.c.

References LED_CHANNEL, LED_DUTY_RES, LED_FREQUENCY, LED_GPIO_PIN, LED_SPEED_MODE, LED_TIMER, s_active_max_brightness, s_led_mutex, and set_pwm_duty().

Referenced by app_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ led_set_brightness()

void led_set_brightness ( uint8_t brightness)

Dynamically updates the LED maximum brightness.

Parameters
[in]brightnessValue from 0 (off) to 255 (max).

Definition at line 188 of file led.c.

References LED_MODE_NORMAL, LED_MODE_WARN, s_active_max_brightness, s_config_brightness, s_current_mode, s_led_mutex, and set_pwm_duty().

Referenced by app_main(), and config_set_led_brightness().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ led_set_mode()

void led_set_mode ( led_mode_t mode)

Sets the current operational mode of the LED.

Modes include static, blinking, and breathing effects.

Parameters
[in]modeThe desired led_mode_t to activate.

Definition at line 141 of file led.c.

References LED_MODE_BOOT_BREATHING, LED_MODE_ERROR, LED_MODE_NORMAL, LED_MODE_OFF, LED_MODE_RESET, LED_MODE_WARN, s_active_max_brightness, s_config_brightness, s_current_mode, s_led_mutex, set_pwm_duty(), and update_led_generator_unsafe().

Referenced by app_main().

Here is the call graph for this function:
Here is the caller graph for this function: