Added Master/Slave detection from set Jumper
This commit is contained in:
parent
3695ac61ad
commit
e4fa55d03f
14
main/main.c
14
main/main.c
@ -9,7 +9,9 @@
|
||||
#include "esp_wifi.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "hal/gpio_types.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "portmacro.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -377,8 +379,16 @@ static esp_err_t example_espnow_init(void) {
|
||||
}
|
||||
|
||||
void app_main(void) {
|
||||
gpio_reset_pin(2);
|
||||
gpio_set_direction(2, GPIO_MODE_OUTPUT);
|
||||
gpio_reset_pin(23);
|
||||
gpio_set_direction(23, GPIO_MODE_INPUT);
|
||||
int checkMaster = gpio_get_level(23);
|
||||
if (checkMaster == 0) {
|
||||
isMaster = true;
|
||||
}
|
||||
|
||||
ESP_LOGI(tag, "ESP MASTER State %d\n", isMaster);
|
||||
|
||||
vTaskDelay(500/portTICK_PERIOD_MS);
|
||||
|
||||
wifi_init();
|
||||
example_espnow_init();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user