gpio
This commit is contained in:
@ -3,7 +3,9 @@
|
||||
#include "gpio.h"
|
||||
|
||||
#include <driver/gpio.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
static const char *TAG = "gpio";
|
||||
|
||||
|
||||
void gpioInit() {
|
||||
@ -11,10 +13,15 @@ void gpioInit() {
|
||||
io_conf.intr_type = GPIO_INTR_DISABLE;
|
||||
io_conf.pin_bit_mask = (1ULL << GPIO_FORCE_PROV);
|
||||
io_conf.mode = GPIO_MODE_INPUT;
|
||||
io_conf.pull_up_en = 1;
|
||||
io_conf.pull_up_en = 0;
|
||||
io_conf.pull_down_en = 1;
|
||||
gpio_config(&io_conf);
|
||||
|
||||
ESP_LOGI(TAG, "gpios configured");
|
||||
}
|
||||
|
||||
bool isGpioForceProv() {
|
||||
return 0 == gpio_get_level(GPIO_FORCE_PROV);
|
||||
int r = gpio_get_level(GPIO_FORCE_PROV);
|
||||
ESP_LOGI(TAG, "forceProv pin is %d", r);
|
||||
return (r != 0);
|
||||
}
|
@ -116,6 +116,8 @@ esp_err_t custom_prov_data_handler(uint32_t session_id, const uint8_t *inbuf, ss
|
||||
|
||||
void networkInit(bool forceProv)
|
||||
{
|
||||
ESP_LOGI(TAG, "forceProv: %d", forceProv);
|
||||
|
||||
/* Initialize TCP/IP */
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
|
||||
|
Reference in New Issue
Block a user