wip:
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "ate0004.h"
|
||||
|
||||
static i2c_master_bus_handle_t i2c_bus_handle = NULL;
|
||||
static httpd_handle_t webserver_handle = NULL;
|
||||
|
||||
static zh_pcf8574_handle_t button_handle = {0};
|
||||
static zh_pcf8574_handle_t led_handle = {0};
|
||||
@@ -11,6 +12,7 @@ static bool is_ret = false;
|
||||
static bool is_ext = false;
|
||||
|
||||
static void zh_wifi_softap_init(void);
|
||||
static void zh_webserver_init(void);
|
||||
static void zh_gpio_init(void);
|
||||
static void zh_io_expander_init(void);
|
||||
static void zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
|
||||
@@ -22,6 +24,7 @@ void app_main(void)
|
||||
nvs_flash_init();
|
||||
esp_event_loop_create_default();
|
||||
zh_wifi_softap_init();
|
||||
zh_webserver_init();
|
||||
zh_gpio_init();
|
||||
gpio_set_level(TRIAC_GPIO, LOW);
|
||||
zh_io_expander_init();
|
||||
@@ -49,6 +52,13 @@ static void zh_wifi_softap_init(void)
|
||||
esp_wifi_start();
|
||||
}
|
||||
|
||||
static void zh_webserver_init(void)
|
||||
{
|
||||
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
|
||||
httpd_start(&webserver_handle, &config);
|
||||
ota_ws_register_uri_handler(webserver_handle);
|
||||
}
|
||||
|
||||
static void zh_gpio_init(void)
|
||||
{
|
||||
gpio_config_t triac_pin_config = {
|
||||
@@ -164,5 +174,4 @@ static void zh_pcf8574_event_handler(void *arg, esp_event_base_t event_base, int
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf("Interrupt happened on device address 0x%02X on GPIO number %d at level %d.\n", event->i2c_address, event->gpio_number, event->gpio_level);
|
||||
}
|
||||
Reference in New Issue
Block a user