feat(i18n): finish zh-CN example comments and align Strapping term with the glossary
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1d79051250
commit
2b73b57ee6
12 files changed
+84
-84
No files matched your search
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Exemplo ESP-IoT-Solution para ESP32
|
||||
* Inicialização de Botão Inteligente com Callbacks e Driver de Display/Sensores
|
||||
* 面向 ESP32 的 ESP-IoT-Solution 示例
|
||||
* 智能按键初始化,包含回调和显示屏/传感器驱动
|
||||
*
|
||||
* Dependência (idf_component.yml):
|
||||
* 依赖(idf_component.yml):
|
||||
* espressif/button: "^3.3.0"
|
||||
* espressif/led_indicator: "^1.2.0"
|
||||
*/
|
||||
@@ -16,19 +16,19 @@
|
||||
|
||||
static const char *TAG = "iot_solution_app";
|
||||
|
||||
#define BUTTON_GPIO_NUM 0 // Botão BOOT nativo
|
||||
#define LED_INDICATOR_GPIO 2 // LED indicador
|
||||
#define BUTTON_GPIO_NUM 0 // 原生 BOOT 按键
|
||||
#define LED_INDICATOR_GPIO 2 // 指示 LED
|
||||
|
||||
static led_indicator_handle_t led_handle = NULL;
|
||||
|
||||
/* Callback para clique único do botão */
|
||||
/* 按键单击回调 */
|
||||
static void button_single_click_cb(void *arg, void *data)
|
||||
{
|
||||
ESP_LOGI(TAG, "Evento: Clique Único detectado!");
|
||||
led_indicator_start(led_handle, BLINK_DOUBLE_FAST);
|
||||
}
|
||||
|
||||
/* Callback para clique longo (> 3 segundos) */
|
||||
/* 长按回调(> 3 秒) */
|
||||
static void button_long_press_cb(void *arg, void *data)
|
||||
{
|
||||
ESP_LOGW(TAG, "Evento: Pressionamento Longo! Acionando modo de reset de fábrica.");
|
||||
@@ -39,14 +39,14 @@ void app_main(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "Iniciando ESP-IoT-Solution Component Suite");
|
||||
|
||||
// 1. Configuração do LED Indicator
|
||||
// 1. LED Indicator 配置
|
||||
led_indicator_gpio_config_t led_cfg = {
|
||||
.is_active_level_high = true,
|
||||
.gpio_num = LED_INDICATOR_GPIO,
|
||||
};
|
||||
led_handle = led_indicator_create(&led_cfg);
|
||||
|
||||
// 2. Configuração do Botão com debounce de hardware/software automático
|
||||
// 2. 按键配置,自动进行硬件/软件消抖
|
||||
button_config_t btn_cfg = {
|
||||
.type = BUTTON_TYPE_GPIO,
|
||||
.long_press_time = 3000,
|
||||
@@ -60,7 +60,7 @@ void app_main(void)
|
||||
button_handle_t btn_handle = iot_button_create(&btn_cfg);
|
||||
assert(btn_handle != NULL);
|
||||
|
||||
// Registra callbacks para diferentes gestos
|
||||
// 为不同手势注册回调
|
||||
iot_button_register_cb(btn_handle, BUTTON_SINGLE_CLICK, button_single_click_cb, NULL);
|
||||
iot_button_register_cb(btn_handle, BUTTON_LONG_PRESS_START, button_long_press_cb, NULL);
|
||||
|
||||
|
||||
Reference in new issue
Block a user