Light Controller Exported Functions

group Light_Controller_Exported_Functions

Functions

bool light_controller_init(void)

initialize light controller

返回值:
  • TRUE – initialize success

  • FALSE – initialize failed

void light_controller_deinit(void)

deinitialize light controller

void light_set_lightness_linear(light_t *light, uint16_t lightness, uint32_t time, light_change_done_cb cb)

set lightness gradual change

参数:
  • light[in] light channel

  • lightness[in] target lightness

  • time[in] gradual change time

  • cb[in] light change done callback function

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)

blink light

参数:
  • light[in] light channel

  • lightness_begin[in] blink start lightness

  • lightness_end[in] blink end lightness

  • interval[in] blink interval, the unit is ms

  • begin_duty[in] start lightness duty in total interval, value range is 0-100 for example, interval is 1000ms, duty is 60, then start lightness will lighten 600ms, end lightness will lighten 400ms

  • cb[in] light change done callback function

  • times[in] blink times

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)

breath light

参数:
  • light[in] light channel

  • lightness_begin[in] breath start lightness

  • lightness_end[in] breath end lightness

  • interval[in] breath interval, the unit is ms

  • forward_duty[in] start lightness duty in total interval, value range is 0-100 for example, interval is 1000ms, duty is 60, then start lightness will lighten 600ms, end lightness will lighten 400ms

  • times[in] breath times

  • half_breath_end[in] whether the last breath is half or not, if TRUE, lightness will stay on lightness_end, otherwise lightness till stay on lightness_begin

  • cb[in] light change done callback function

void light_stop(light_t *light)

stop light action

参数:

light[in] light channel

bool is_light_controller_busy(void)

check whether light controller is busy or not

返回值:
  • TRUE – busy

  • FALSE – idle

bool is_light_busy(const light_t *light)

check whether light is busy or not

返回值:
  • TRUE – busy

  • FALSE – idle