From e5bbd0fbf8dab47794a1b59a4d0f80b1123ec7de Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sun, 15 Jul 2018 14:55:30 +0200 Subject: [PATCH] generic board hal file added --- platformio.ini | 18 +++++++++++++++++- src/hal/generic.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/hal/generic.h diff --git a/platformio.ini b/platformio.ini index b53b07b8..16ab8b67 100644 --- a/platformio.ini +++ b/platformio.ini @@ -11,7 +11,8 @@ ; ---> SELECT TARGET PLATFORM HERE! <--- [platformio] -env_default = heltec +env_default = generic +;env_default = heltec ;env_default = ttgov1 ;env_default = ttgov2 ;env_default = ttgov21 @@ -184,5 +185,20 @@ monitor_speed = 115200 lib_deps = ${common_env_data.lib_deps_all} ${common_env_data.lib_deps_rgbled} +build_flags = + ${common_env_data.build_flags} + +[env:generic] +platform = ${common_env_data.platform_espressif32} +framework = arduino +board = esp32dev +board_build.partitions = ${common_env_data.board_build.partitions} +upload_speed = 921600 +monitor_speed = 115200 +lib_deps = + ${common_env_data.lib_deps_all} + ${common_env_data.lib_deps_rgbled} + ${common_env_data.lib_deps_gps} + ${common_env_data.lib_deps_display} build_flags = ${common_env_data.build_flags} \ No newline at end of file diff --git a/src/hal/generic.h b/src/hal/generic.h new file mode 100644 index 00000000..a22d5b23 --- /dev/null +++ b/src/hal/generic.h @@ -0,0 +1,34 @@ +// Hardware related definitions for generic ESP32 boards + +#define HAS_LORA 1 // comment out if device shall not send data via LoRa or has no LoRa +#define HAS_SPI 1 // comment out if device shall not send data via SPI +#define CFG_sx1276_radio 1 // select LoRa chip +//#define CFG_sx1272_radio 1 // select LoRa chip +#define BOARD_HAS_PSRAM // use if board has external PSRAM + +#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C +//#define DISPLAY_FLIP 1 // use if display is rotated +#define HAS_BATTERY_PROBE ADC1_GPIO35_CHANNEL // uses GPIO7 +#define BATT_FACTOR 2 // voltage divider 100k/100k on board + +#define HAS_LED GPIO_NUM_21 // on board green LED_G1 + +#define HAS_BUTTON GPIO_NUM_39 // use if board has button + +#define HAS_GPS 1 // use if board has GPS +#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M or 7M with default configuration + +// pin definitions for SPI interface of LoRa chip +#define PIN_SPI_SS GPIO_NUM_18 // SPI Chip Select +#define PIN_SPI_MOSI GPIO_NUM_27 // SPI Data Input +#define PIN_SPI_MISO GPIO_NUM_19 // SPI Data Output +#define PIN_SPI_SCK GPIO_NUM_5 // SPI Clock +#define RST LMIC_UNUSED_PIN // LoRa Reset (if wired) +#define DIO0 GPIO_NUM_26 // LoRa IO0 +#define DIO1 GPIO_NUM_32 // LoRa IO1 +#define DIO2 LMIC_UNUSED_PIN // LoRa IO2 (not needed) + +// pin definitions for I2C interface of OLED Display +#define OLED_RST GPIO_NUM_16 // SSD1306 RST +#define OLED_SDA GPIO_NUM_4 // SD1306 D1+D2 +#define OLED_SCL GPIO_NUM_15 // SD1306 D0 \ No newline at end of file