esp-idf/examples/bluetooth/esp_ble_mesh/common_components/light_driver
morris 16677b0d3c global: make periph enable/disable APIs private
peripheral enable/disable usually should be managed by driver itself,
so make it as espressif private APIs, not recommended for user to use it
in application code.
However, if user want to re-write the driver or ports to other platform,
this is still possible by including the header in this way:
"esp_private/peripheral_ctrl.h"
2021-11-08 10:37:47 +08:00
..
include ble mesh: add aligenie ble mesh example 2020-11-25 14:33:33 +08:00
CMakeLists.txt ble mesh: add aligenie ble mesh example 2020-11-25 14:33:33 +08:00
component.mk ble mesh: add aligenie ble mesh example 2020-11-25 14:33:33 +08:00
iot_led.c gptimer: clean up hal and ll for driver-ng 2021-10-20 18:40:08 +08:00
iot_light.c global: make periph enable/disable APIs private 2021-11-08 10:37:47 +08:00
light_driver.c ble_mesh: aligenie_demo: Add sdkconfig.defaults for esp32c3 2021-02-24 20:08:04 +08:00
README.md ble mesh: add aligenie ble mesh example 2020-11-25 14:33:33 +08:00

Component: Light

  • This component defines a light as a well encapsulated object.

  • A light device is defined by:

    • ledc timer which is used to control the pwm channels of light
    • mode of the ledc timer
    • frequency of the ledc timer
    • pwm channel number of the light
    • bit number of the ledc timer
  • A light device can provide:

    • iot_light_channel_regist function to add channel to corresponding channel id
    • iot_light_duty_write function to set the duty of corresponding channel and it support setting duty directly or gradually
    • iot_light_breath_write function to set the corresponding channel to breath mode and breath period can be set
    • iot_light_blink_starte and iot_light_blink_stop function to make some of channels to blink in appointed period. Note that if any channel works in blink mode, all the other channels would be turned off.
  • To use the light device, you need to:

    • create a light object returned by iot_light_create()
    • regist the light channels according the channel number by iot_light_channel_regist()
    • To free the object, you can call iot_light_delete to delete the button object and free the memory.

NOTE:

If any channel(s) work(s) in blink mode, all the other channels would be turned off. iot_light_blink_stop() must be called before setting any channel to other mode(write duty or breath).