Remove unecessary wake & Kconfig board-speicifc init
This commit is contained in:
@@ -12,4 +12,11 @@ menu "espScope Configuration"
|
|||||||
GPIO pin number to hold low on boot to erase NVS (Factory Reset).
|
GPIO pin number to hold low on boot to erase NVS (Factory Reset).
|
||||||
Default is 9 (BOOT button on Seeed XIAO ESP32C6).
|
Default is 9 (BOOT button on Seeed XIAO ESP32C6).
|
||||||
|
|
||||||
|
config BOARD_SPECIFIC_INIT
|
||||||
|
string "Name of file containing any board specfic initialisation"
|
||||||
|
help
|
||||||
|
If your board requires some specific initialization C code, place it in
|
||||||
|
a file called "./boards/<your board name>.h" and set this to "./boards/your board name.h"
|
||||||
|
Default is don't include any board-specific initialization file.
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|||||||
14
main/boards/xiao_esp32c6.h
Normal file
14
main/boards/xiao_esp32c6.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// Seeed XIAO ESP32C6: Configure GPIO 3 and GPIO 14 as outputs for Wifi antenna switch
|
||||||
|
{
|
||||||
|
gpio_config_t board_io_conf = {
|
||||||
|
.pin_bit_mask = (1ULL << 3) | (1ULL << 14),
|
||||||
|
.mode = GPIO_MODE_OUTPUT,
|
||||||
|
.pull_up_en = GPIO_PULLUP_DISABLE,
|
||||||
|
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
||||||
|
.intr_type = GPIO_INTR_DISABLE};
|
||||||
|
gpio_config(&board_io_conf);
|
||||||
|
|
||||||
|
// Set GPIO 3 and GPIO 14 to low
|
||||||
|
gpio_set_level(3, 0);
|
||||||
|
gpio_set_level(14, 0);
|
||||||
|
}
|
||||||
19
main/main.c
19
main/main.c
@@ -331,20 +331,9 @@ void app_main(void) {
|
|||||||
gpio_set_level(CONFIG_LED_BUILTIN, 0);
|
gpio_set_level(CONFIG_LED_BUILTIN, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Board-specific WiFi init (if any) */
|
#ifdef CONFIG_BOARD_SPECIFIC_INIT
|
||||||
// Seeed XIAO ESP32C6: Configure GPIO 3 and GPIO 14 as outputs
|
#include CONFIG_BOARD_SPECIFIC_INIT
|
||||||
gpio_config_t board_io_conf = {
|
#endif
|
||||||
.pin_bit_mask = (1ULL << 3) | (1ULL << 14),
|
|
||||||
.mode = GPIO_MODE_OUTPUT,
|
|
||||||
.pull_up_en = GPIO_PULLUP_DISABLE,
|
|
||||||
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
|
||||||
.intr_type = GPIO_INTR_DISABLE};
|
|
||||||
gpio_config(&board_io_conf);
|
|
||||||
|
|
||||||
// Set GPIO 3 and GPIO 14 to low
|
|
||||||
gpio_set_level(3, 0);
|
|
||||||
gpio_set_level(14, 0);
|
|
||||||
/* end board-specific WiFi init (if any) */
|
|
||||||
|
|
||||||
is_ap = wifi_manager_init_wifi();
|
is_ap = wifi_manager_init_wifi();
|
||||||
|
|
||||||
@@ -503,9 +492,9 @@ static esp_err_t power_handler(httpd_req_t* req) {
|
|||||||
httpd_resp_set_hdr(req, "Content-Type", "text/html; charset=utf-8");
|
httpd_resp_set_hdr(req, "Content-Type", "text/html; charset=utf-8");
|
||||||
httpd_resp_send(req, "<html><body><h1>Bye!</h1></body></html>", HTTPD_RESP_USE_STRLEN);
|
httpd_resp_send(req, "<html><body><h1>Bye!</h1></body></html>", HTTPD_RESP_USE_STRLEN);
|
||||||
|
|
||||||
|
// delay to ensure network is flushed
|
||||||
vTaskDelay(pdMS_TO_TICKS(200));
|
vTaskDelay(pdMS_TO_TICKS(200));
|
||||||
|
|
||||||
esp_sleep_enable_timer_wakeup(30L * 24L * 60L * 60L * 1000000ULL); // One month
|
|
||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user