add pinIndex structure for ESP8266 and ESP32
This commit is contained in:
parent
8861393e80
commit
0227427b6f
5 changed files with 95 additions and 22 deletions
|
@ -68,23 +68,17 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CanGrow platform specific includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef ESP8266
|
|
||||||
#include "include/CanGrow_ESP8266.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ESP32
|
|
||||||
#include "include/CanGrow_ESP32.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CanGrow includes
|
* CanGrow includes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* main header file, where all variables, consts and structs get defined */
|
||||||
#include "include/CanGrow.h"
|
#include "include/CanGrow.h"
|
||||||
|
/* CanGrow platform specific includes */
|
||||||
|
#include "include/CanGrow_ESP8266.h"
|
||||||
|
#include "include/CanGrow_ESP32.h"
|
||||||
|
/* CanGrow header with all functions */
|
||||||
#include "include/CanGrow_Core.h"
|
#include "include/CanGrow_Core.h"
|
||||||
#include "include/CanGrow_Wifi.h"
|
#include "include/CanGrow_Wifi.h"
|
||||||
#include "include/CanGrow_LittleFS.h"
|
#include "include/CanGrow_LittleFS.h"
|
||||||
|
|
|
@ -96,14 +96,29 @@ struct Config_Grow {
|
||||||
Config_Grow configGrow;
|
Config_Grow configGrow;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Config {
|
struct Config {
|
||||||
char test[16] = "123";
|
char test[16] = "123";
|
||||||
};
|
};
|
||||||
|
|
||||||
Config config;
|
Config config;
|
||||||
|
|
||||||
|
/* actual structure initialization for Pin_Index is done within the header files
|
||||||
|
* for ESP32 and ESP8266
|
||||||
|
*
|
||||||
|
* notes explenation:
|
||||||
|
* - BF_L: BootFails when LOW
|
||||||
|
* - BF_H: BootFails when HIGH
|
||||||
|
* - FM_L: FlashMode needs LOW to enter
|
||||||
|
* - IN_O: Input Only
|
||||||
|
*/
|
||||||
|
const char* BF_L = "BF_L";
|
||||||
|
const char* BF_H = "BF_H";
|
||||||
|
const char* FM_L = "FM_L";
|
||||||
|
const char* IN_O = "IN_O";
|
||||||
|
|
||||||
|
struct Pin_Index {
|
||||||
|
const byte gpio;
|
||||||
|
const char* notes[8];
|
||||||
|
char* usedBy[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,62 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#ifdef ESP32
|
||||||
|
|
||||||
#define PinWIPE 2
|
#define PinWIPE 2
|
||||||
#define PinWIPE_default LOW
|
#define PinWIPE_default LOW
|
||||||
#define Pin_I2C_SCL = 22;
|
#define Pin_I2C_SCL = 22;
|
||||||
#define Pin_I2C_SDA = 21;
|
#define Pin_I2C_SDA = 21;
|
||||||
|
|
||||||
// free usable pins
|
/* https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
|
||||||
|
*
|
||||||
|
* free usable pins
|
||||||
|
* - GPIO 0 PU OK outputs PWM signal at boot, must be LOW to enter flashing mode
|
||||||
|
* - GPIO 4 OK OK
|
||||||
|
* - GPIO 5 OK OK outputs PWM signal at boot, strapping pin
|
||||||
|
* - GPIO 12 OK OK boot fails if pulled high, strapping pin
|
||||||
|
* - GPIO 13 OK OK
|
||||||
|
* - GPIO 14 OK OK outputs PWM signal at boot
|
||||||
|
* - GPIO 15 OK OK outputs PWM signal at boot, strapping pin
|
||||||
|
* - GPIO 16 OK OK
|
||||||
|
* - GPIO 17 OK OK
|
||||||
|
* - GPIO 18 OK OK
|
||||||
|
* - GPIO 19 OK OK
|
||||||
|
* - GPIO 23 OK OK
|
||||||
|
* - GPIO 25 OK OK
|
||||||
|
* - GPIO 26 OK OK
|
||||||
|
* - GPIO 27 OK OK
|
||||||
|
* - GPIO 32 OK OK
|
||||||
|
* - GPIO 33 OK OK
|
||||||
|
* - GPIO 34 OK input only
|
||||||
|
* - GPIO 35 OK input only
|
||||||
|
* - GPIO 36 OK input only
|
||||||
|
* - GPIO 39 OK input only
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
const byte pinIndex_length = 21;
|
||||||
|
// initialize pinIndex with all usable GPIOs
|
||||||
|
Pin_Index pinIndex[] = { { 0, FM_L },
|
||||||
|
{ 4 },
|
||||||
|
{ 5 },
|
||||||
|
{ 12, BF_H },
|
||||||
|
{ 13 },
|
||||||
|
{ 14 },
|
||||||
|
{ 15 },
|
||||||
|
{ 16 },
|
||||||
|
{ 17 },
|
||||||
|
{ 18 },
|
||||||
|
{ 19 },
|
||||||
|
{ 23 },
|
||||||
|
{ 25 },
|
||||||
|
{ 26 },
|
||||||
|
{ 27 },
|
||||||
|
{ 32 },
|
||||||
|
{ 33 },
|
||||||
|
{ 34, IN_O },
|
||||||
|
{ 35, IN_O },
|
||||||
|
{ 36, IN_O },
|
||||||
|
{ 39, IN_O } };
|
||||||
|
#endif
|
||||||
|
|
|
@ -26,14 +26,16 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#ifdef ESP8266
|
||||||
|
|
||||||
|
// GPIO 2 Boot fails if pulled to LOW
|
||||||
#define PinWIPE 2
|
#define PinWIPE 2
|
||||||
#define PinWIPE_default HIGH
|
#define PinWIPE_default HIGH
|
||||||
#define Pin_I2C_SCL = 5;
|
#define Pin_I2C_SCL = 5;
|
||||||
#define Pin_I2C_SDA = 4;
|
#define Pin_I2C_SDA = 4;
|
||||||
|
|
||||||
/*
|
/* https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/
|
||||||
|
*
|
||||||
* free usable pins
|
* free usable pins
|
||||||
* - GPIO 0 / D3 boot fails if pulled LOW
|
* - GPIO 0 / D3 boot fails if pulled LOW
|
||||||
* - GPIO 12 / D6
|
* - GPIO 12 / D6
|
||||||
|
@ -42,3 +44,14 @@
|
||||||
* - GPIO 15 / D8 Boot fails if pulled HIGH
|
* - GPIO 15 / D8 Boot fails if pulled HIGH
|
||||||
* - GPIO 16 / D0
|
* - GPIO 16 / D0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const byte pinIndex_length = 6;
|
||||||
|
// initialize pinIndex with all usable GPIOs
|
||||||
|
Pin_Index pinIndex[] = { { 0, BF_L },
|
||||||
|
{ 12 },
|
||||||
|
{ 13 },
|
||||||
|
{ 14 },
|
||||||
|
{ 15, BF_H },
|
||||||
|
{ 16 } };
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
|
|
||||||
AsyncWebServer webserver(80);
|
AsyncWebServer webserver(80);
|
||||||
// log incoming requests
|
// load requestLogger middleware
|
||||||
LoggingMiddleware requestLogger;
|
LoggingMiddleware requestLogger;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue