Light Controller Exported Functions
- group Light_Controller_Exported_Functions
-
Exported functions for the light controller module.
Functions
-
bool light_controller_init(void)
-
Initializes the light controller.
- Return values:
true – Initialization successful.
false – Initialization failed. Ensure that the platform types are correctly defined and the initialization conditions are met.
- Returns:
-
The operation result.
-
void light_controller_deinit(void)
-
Deinitializes the light controller.
-
void light_set_lightness_linear(light_t *light, uint16_t lightness, uint32_t time, light_change_done_cb cb)
-
Sets lightness gradual change for a light channel.
- Parameters:
light – [in] Pointer to the light channel.
lightness – [in] Target lightness. Value range is 0-65535.
time – [in] Gradual change time in milliseconds.
cb – [in] Callback function invoked upon light change completion.
-
void light_blink(light_t *light, uint16_t lightness_begin, uint16_t lightness_end, uint32_t interval, uint8_t begin_duty, uint32_t times, light_change_done_cb cb)
-
Causes the light to blink.
- Parameters:
light – [in] Pointer to the light channel.
lightness_begin – [in] Blink start lightness. Value range is 0-65535.
lightness_end – [in] Blink end lightness. Value range is 0-65535.
interval – [in] Blink interval in milliseconds.
begin_duty – [in] Start lightness duty cycle in total interval, value range is 0-100. For example, if interval is 1000ms, and duty is set to 60, then start lightness will last for 600ms.
cb – [in] Callback function called when light change is done.
times – [in] Number of blink cycles.
-
void light_breath(light_t *light, uint16_t lightness_begin, uint16_t lightness_end, uint32_t interval, uint8_t forward_duty, uint32_t times, bool half_breath_end, light_change_done_cb cb)
-
Causes the light to breathe.
- Parameters:
light – [in] Pointer to the light channel.
lightness_begin – [in] Breath start lightness. Value range is 0-65535.
lightness_end – [in] Breath end lightness. Value range is 0-65535.
interval – [in] Breath cycle time, in milliseconds.
forward_duty – [in] Start lightness duty in total interval, value range is 0-100. For example, if interval is 1000ms, duty is 60, then start lightness will last for 600ms.
times – [in] Number of breath cycles.
half_breath_end – [in] Indicates if the last breath is half or not. If true, lightness will remain at lightness_end. Default is false.
cb – [in] Callback function invoked upon breath completion.
-
void light_stop(light_t *light)
-
Stops the current action on a light channel.
- Parameters:
-
light – [in] Pointer to the light channel to stop the action.
-
bool is_light_controller_busy(void)
-
Checks whether the light controller is busy or not.
- Return values:
true – Controller is currently busy.
false – Controller is currently idle. Check for pending operations or errors.
- Returns:
-
The operation result.
-
bool is_light_busy(const light_t *light)
-
Checks whether a specific light is busy or not.
- Parameters:
-
light – [in] Pointer to the light channel to check.
- Return values:
true – The specified light is busy.
false – The specified light is idle. Ensure light operations are properly initiated if expected take action.
- Returns:
-
The operation result.
-
bool light_controller_init(void)