forked from espressif/esp-idf
Merge branch 'feature/add_led_config_for_ot_device' into 'master'
feat(openthread): support configuring indicator color of OpenThread device See merge request espressif/esp-idf!29413
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
menu "OpenThread Device Role LED"
|
menu "OpenThread Device Role Indicator"
|
||||||
|
|
||||||
orsource "$IDF_PATH/examples/common_components/env_caps/$IDF_TARGET/Kconfig.env_caps"
|
orsource "$IDF_PATH/examples/common_components/env_caps/$IDF_TARGET/Kconfig.env_caps"
|
||||||
|
|
||||||
@@ -21,4 +21,108 @@ menu "OpenThread Device Role LED"
|
|||||||
GPIO number (IOxx) to blink on and off the LED.
|
GPIO number (IOxx) to blink on and off the LED.
|
||||||
Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink.
|
Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink.
|
||||||
|
|
||||||
|
menu "Indicator of Leader Device"
|
||||||
|
config LEADER_INDICATOR_RED
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "red config"
|
||||||
|
range 0 255
|
||||||
|
default 40
|
||||||
|
help
|
||||||
|
Red config of LED for OpenThread leader device
|
||||||
|
|
||||||
|
config LEADER_INDICATOR_GREEN
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "green config"
|
||||||
|
range 0 255
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Red config of LED for OpenThread leader device
|
||||||
|
|
||||||
|
config LEADER_INDICATOR_BLUE
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "blue config"
|
||||||
|
range 0 255
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Blue config of LED for OpenThread leader device
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
menu "Indicator of Router Device"
|
||||||
|
config ROUTER_INDICATOR_RED
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "red config"
|
||||||
|
range 0 255
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Red config of LED for OpenThread router device
|
||||||
|
|
||||||
|
config ROUTER_INDICATOR_GREEN
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "green config"
|
||||||
|
range 0 255
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Green config of LED for OpenThread router device
|
||||||
|
|
||||||
|
config ROUTER_INDICATOR_BLUE
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "blue config"
|
||||||
|
range 0 255
|
||||||
|
default 40
|
||||||
|
help
|
||||||
|
Blue config of LED for OpenThread router device
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
menu "Indicator of Child Device"
|
||||||
|
config CHILD_INDICATOR_RED
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "red config"
|
||||||
|
range 0 255
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Red config of LED for OpenThread child device
|
||||||
|
|
||||||
|
config CHILD_INDICATOR_GREEN
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "green config"
|
||||||
|
range 0 255
|
||||||
|
default 40
|
||||||
|
help
|
||||||
|
Green config of LED for OpenThread child device
|
||||||
|
|
||||||
|
config CHILD_INDICATOR_BLUE
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "blue config"
|
||||||
|
range 0 255
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Blue config of LED for OpenThread child device
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
menu "Indicator of Detached Device"
|
||||||
|
config DETACHED_INDICATOR_RED
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "red config"
|
||||||
|
range 0 255
|
||||||
|
default 20
|
||||||
|
help
|
||||||
|
Red config of LED for OpenThread detached device
|
||||||
|
|
||||||
|
config DETACHED_INDICATOR_GREEN
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "green config"
|
||||||
|
range 0 255
|
||||||
|
default 20
|
||||||
|
help
|
||||||
|
Green config of LED for OpenThread detached device
|
||||||
|
|
||||||
|
config DETACHED_INDICATOR_BLUE
|
||||||
|
depends on OPENTHREAD_STATE_INDICATOR_ENABLE
|
||||||
|
int "blue config"
|
||||||
|
range 0 255
|
||||||
|
default 20
|
||||||
|
help
|
||||||
|
Blue config of LED for OpenThread detached device
|
||||||
|
endmenu
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@@ -45,13 +45,13 @@ static void ot_indicator_change_callback(otChangedFlags changed_flags, void* ctx
|
|||||||
if (role == OT_DEVICE_ROLE_DISABLED) {
|
if (role == OT_DEVICE_ROLE_DISABLED) {
|
||||||
esp_openthread_state_indicator_clear();
|
esp_openthread_state_indicator_clear();
|
||||||
} else if (role == OT_DEVICE_ROLE_DETACHED) {
|
} else if (role == OT_DEVICE_ROLE_DETACHED) {
|
||||||
esp_openthread_state_indicator_set(0, 40, 0, 0);
|
esp_openthread_state_indicator_set(0, CONFIG_DETACHED_INDICATOR_RED, CONFIG_DETACHED_INDICATOR_GREEN, CONFIG_DETACHED_INDICATOR_BLUE);
|
||||||
} else if (role == OT_DEVICE_ROLE_LEADER) {
|
} else if (role == OT_DEVICE_ROLE_LEADER) {
|
||||||
esp_openthread_state_indicator_set(0, 0, 40, 0);
|
esp_openthread_state_indicator_set(0, CONFIG_LEADER_INDICATOR_RED, CONFIG_LEADER_INDICATOR_GREEN, CONFIG_LEADER_INDICATOR_BLUE);
|
||||||
} else if (role == OT_DEVICE_ROLE_ROUTER) {
|
} else if (role == OT_DEVICE_ROLE_ROUTER) {
|
||||||
esp_openthread_state_indicator_set(0, 0, 0, 40);
|
esp_openthread_state_indicator_set(0, CONFIG_ROUTER_INDICATOR_RED, CONFIG_ROUTER_INDICATOR_GREEN, CONFIG_ROUTER_INDICATOR_BLUE);
|
||||||
} else if (role == OT_DEVICE_ROLE_CHILD) {
|
} else if (role == OT_DEVICE_ROLE_CHILD) {
|
||||||
esp_openthread_state_indicator_set(0, 40, 8, 60);
|
esp_openthread_state_indicator_set(0, CONFIG_CHILD_INDICATOR_RED, CONFIG_CHILD_INDICATOR_GREEN, CONFIG_CHILD_INDICATOR_BLUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user