You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @brief LED state: 0-100, only hardware that supports to set brightness can adjust brightness.
25
32
*
@@ -70,32 +77,58 @@ typedef enum {
70
77
LED_CUSTOM_MODE, /*!< blink with custom driver */
71
78
} led_indicator_mode_t;
72
79
73
-
/**
74
-
* @brief LED indicator specified configurations, as a arg when create a new indicator
75
-
*
76
-
*/
77
80
typedefstruct {
78
-
led_indicator_mode_tmode; /*!< LED work mode, eg. GPIO or pwm mode */
79
-
union {
80
-
led_indicator_gpio_config_t*led_indicator_gpio_config; /*!< LED GPIO configuration */
81
-
led_indicator_ledc_config_t*led_indicator_ledc_config; /*!< LED LEDC configuration */
82
-
led_indicator_rgb_config_t*led_indicator_rgb_config; /*!< LED RGB configuration */
83
-
led_indicator_strips_config_t*led_indicator_strips_config; /*!< LED LEDC rgb configuration */
84
-
led_indicator_custom_config_t*led_indicator_custom_config; /*!< LED custom configuration */
85
-
}; /**< LED configuration */
81
+
esp_err_t (*hal_indicator_set_on_off)(void*hardware_data, boolon_off); /*!< Pointer function for setting on or off */
82
+
esp_err_t (*hal_indicator_deinit)(void*hardware_data); /*!< Pointer function for Deinitialization */
83
+
esp_err_t (*hal_indicator_set_brightness)(void*hardware_data, uint32_tbrightness); /*!< Pointer function for setting brightness, must be supported by hardware */
84
+
esp_err_t (*hal_indicator_set_rgb)(void*hardware, uint32_trgb_value); /*!< Pointer function for setting rgb, must be supported by hardware */
85
+
esp_err_t (*hal_indicator_set_hsv)(void*hardware, uint32_thsv_value); /*!< Pointer function for setting hsv, must be supported by hardware */
86
+
void*hardware_data; /*!< Hardware data of the LED indicator */
87
+
led_indicator_mode_tmode; /*!< LED work mode, eg. GPIO or pwm mode */
int*p_blink_steps; /*!< Stage of each blink list */
91
+
led_indicator_ihsv_tcurrent_fade_value; /*!< Current fade value */
92
+
led_indicator_ihsv_tlast_fade_value; /*!< Save the last value. */
93
+
uint16_tfade_value_count; /*!< Count the number of fade */
94
+
uint16_tfade_step; /*!< Step of fade */
95
+
uint16_tfade_total_step; /*!< Total step of fade */
96
+
uint32_tmax_duty; /*!< Max duty cycle from duty_resolution : 2^duty_resolution -1 */
97
+
SemaphoreHandle_tmutex; /*!< Mutex to achieve thread-safe */
98
+
TimerHandle_th_timer; /*!< LED timer handle, invalid if works in pwm mode */
99
+
blink_step_tconst**blink_lists; /*!< User defined LED blink lists */
100
+
uint16_tblink_list_num; /*!< Number of blink lists */
101
+
} _led_indicator_t;
102
+
103
+
typedefstruct_led_indicator_com_config {
104
+
esp_err_t (*hal_indicator_set_on_off)(void*hardware_data, boolon_off); /*!< Pointer function for setting on or off */
105
+
esp_err_t (*hal_indicator_deinit)(void*hardware_data); /*!< Pointer function for Deinitialization */
106
+
esp_err_t (*hal_indicator_set_brightness)(void*hardware_data, uint32_tbrightness); /*!< Pointer function for setting brightness, must be supported by hardware */
107
+
esp_err_t (*hal_indicator_set_rgb)(void*hardware, uint32_trgb_value); /*!< Pointer function for setting rgb, must be supported by hardware */
108
+
esp_err_t (*hal_indicator_set_hsv)(void*hardware, uint32_thsv_value); /*!< Pointer function for setting hsv, must be supported by hardware */
109
+
void*hardware_data; /*!< GPIO number of the LED indicator */
110
+
blink_step_tconst**blink_lists; /*!< User defined LED blink lists */
111
+
uint16_tblink_list_num; /*!< Number of blink lists */
112
+
led_indicator_duty_tduty_resolution; /*!< Resolution of duty setting in number of bits. The range of duty values is [0, (2**duty_resolution) -1]. If the brightness cannot be set, set this as 1. */
113
+
} _led_indicator_com_config_t;
114
+
115
+
typedefstruct {
86
116
blink_step_tconst**blink_lists; /*!< user defined LED blink lists */
87
117
uint16_tblink_list_num; /*!< number of blink lists */
88
-
} led_indicator_config_t;
118
+
} led_config_t;
89
119
90
120
typedefvoid*led_indicator_handle_t; /*!< LED indicator operation handle */
0 commit comments