From 9bc20ead1f57a2c37ef3ed7c9b862b236f5f2689 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Fri, 8 May 2020 23:59:19 +0200 Subject: [PATCH] cleanup pin definitions --- platformio.ini | 26 ++++++++++++++++++-------- src/LoRa_APRS_iGate.cpp | 4 ++-- src/display.cpp | 10 +++++----- src/display.h | 6 ++++++ 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/platformio.ini b/platformio.ini index f79b5db..d7b83f9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,6 +9,8 @@ ; https://docs.platformio.org/page/projectconf.html [env] +platform = espressif32 +framework = arduino lib_ldf_mode = deep+ monitor_speed = 115200 lib_deps = @@ -19,12 +21,20 @@ lib_deps = NTPClient APRS-IS-Lib -[env:heltec_wifi_lora_32] -platform = espressif32 -board = heltec_wifi_lora_32 -framework = arduino +[env:ttgo-lora32-v1] +board = ttgo-lora32-v1 -[env:heltec_wifi_lora_32_V2] -platform = espressif32 -board = heltec_wifi_lora_32_V2 -framework = arduino +[env:ttgo-lora32-v2] +board = ttgo-lora32-v2 + +[env:ttgo-t-beam] +board = ttgo-t-beam +lib_deps = + Adafruit GFX Library + Adafruit SSD1306 + LoRa + APRS-Decoder-Lib + NTPClient + APRS-IS-Lib + TinyGPSPlus + AXP202X_Library diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index cdf9284..daea873 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -182,8 +182,8 @@ void setup_ota() void setup_lora() { Serial.println("[INFO] Set SPI pins!"); - SPI.begin(SCK, MISO, MOSI, SS); - LoRa.setPins(SS, RST_LoRa, DIO0); + SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); + LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ); Serial.println("[INFO] Set LoRa pins!"); long freq = 433775000; diff --git a/src/display.cpp b/src/display.cpp index 9746945..884c188 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -5,16 +5,16 @@ #include "display.h" -Adafruit_SSD1306 display(DISPLAY_WIDTH, DISPLAY_HEIGHT, &Wire, RST_OLED); +Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST); void setup_display() { - pinMode(RST_OLED, OUTPUT); - digitalWrite(RST_OLED, LOW); + pinMode(OLED_RST, OUTPUT); + digitalWrite(OLED_RST, LOW); delay(20); - digitalWrite(RST_OLED, HIGH); + digitalWrite(OLED_RST, HIGH); - Wire.begin(SDA_OLED, SCL_OLED); + Wire.begin(OLED_SDA, OLED_SCL); if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { Serial.println("SSD1306 allocation failed"); diff --git a/src/display.h b/src/display.h index 2aec8de..889c162 100644 --- a/src/display.h +++ b/src/display.h @@ -11,4 +11,10 @@ void show_display(String header, String line1, String line2, String line3, int w void show_display(String header, String line1, String line2, String line3, String line4, int wait = 0); void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait = 0); +#ifdef ARDUINO_T_Beam +#define OLED_SDA 21 +#define OLED_SCL 22 +#define OLED_RST 4 +#endif + #endif