force prov
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
idf_component_register(SRCS "app_main.c"
|
idf_component_register(SRCS "app_main.c"
|
||||||
"network_mngr.c"
|
"network_mngr.c"
|
||||||
|
"gpio.c"
|
||||||
INCLUDE_DIRS ".")
|
INCLUDE_DIRS ".")
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
#include <esp_event.h>
|
#include <esp_event.h>
|
||||||
#include <nvs_flash.h>
|
#include <nvs_flash.h>
|
||||||
|
|
||||||
|
#include "gpio.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const char *TAG = "app";
|
static const char *TAG = "app";
|
||||||
|
|
||||||
@ -32,8 +35,8 @@ void deviceInit() {
|
|||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
deviceInit();
|
deviceInit();
|
||||||
|
gpioInit();
|
||||||
networkInit(false);
|
networkInit(isGpioForceProv());
|
||||||
|
|
||||||
|
|
||||||
/* Start main application now */
|
/* Start main application now */
|
||||||
|
20
src/main/gpio.c
Normal file
20
src/main/gpio.c
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "gpio.h"
|
||||||
|
|
||||||
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void gpioInit() {
|
||||||
|
gpio_config_t io_conf;
|
||||||
|
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;
|
||||||
|
gpio_config(&io_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isGpioForceProv() {
|
||||||
|
return 0 == gpio_get_level(GPIO_FORCE_PROV);
|
||||||
|
}
|
13
src/main/gpio.h
Normal file
13
src/main/gpio.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef _GPIO_H_
|
||||||
|
#define _GPIO_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define GPIO_FORCE_PROV 5
|
||||||
|
|
||||||
|
|
||||||
|
void gpioInit();
|
||||||
|
bool isGpioForceProv();
|
||||||
|
|
||||||
|
#endif // _GPIO_H_
|
Reference in New Issue
Block a user