From 3f1c02191919c6d8f298c47a5c74c8e7a599acac Mon Sep 17 00:00:00 2001 From: Chrisotph Schultz Date: Sun, 21 Mar 2021 16:44:32 +0100 Subject: [PATCH 1/3] adding Board TTGO-LoRa32-v2.1.6 to src/hal/ --- src/hal/getpinmap_thisboard.cpp | 4 +- src/hal/getpinmap_ttgo_lora32_v2.1.cpp | 67 ++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 src/hal/getpinmap_ttgo_lora32_v2.1.cpp diff --git a/src/hal/getpinmap_thisboard.cpp b/src/hal/getpinmap_thisboard.cpp index 77f7d01c..b23d166f 100644 --- a/src/hal/getpinmap_thisboard.cpp +++ b/src/hal/getpinmap_thisboard.cpp @@ -55,14 +55,14 @@ const HalPinmap_t *GetPinmap_ThisBoard(void) return GetPinmap_Catena4630(); #elif defined(ARDUINO_MCCI_CATENA_4801) return GetPinmap_Catena4801(); -#elif defined(ARDUINO_MCCI_CATENA_4802) - return GetPinmap_Catena4802(); #elif defined(ARDUINO_DISCO_L072CZ_LRWAN1) return GetPinmap_Disco_L072cz_Lrwan1(); #elif defined(PINNOCHIO_SCOUT) return GetPinmap_PinnochioScount(); #elif defined(ARDUINO_TTGO_LoRa32_V1) return GetPinmap_ttgo_lora32_v1(); +#elif defined(ARDUINO_TTGO_LoRa32_v21new) + return GetPinmap_ttgo_lora32_v21(); #elif defined(ARDUINO_HELTEC_WIFI_LORA_32) || defined(ARDUINO_HELTEC_WIFI_LORA_32_V2) || defined(ARDUINO_HELTEC_WIRELESS_STICK) return GetPinmap_heltec_lora32(); #else diff --git a/src/hal/getpinmap_ttgo_lora32_v2.1.cpp b/src/hal/getpinmap_ttgo_lora32_v2.1.cpp new file mode 100644 index 00000000..1570b860 --- /dev/null +++ b/src/hal/getpinmap_ttgo_lora32_v2.1.cpp @@ -0,0 +1,67 @@ + + +#include +#include + +#include "../lmic/oslmic.h" + +#define LORA_DIO0 26 +#define LORA_DIO1 33 +#define LORA_DIO2 32 + +namespace Arduino_LMIC { + +class HalConfiguration_ttgo_lora32_v21 : public HalConfiguration_t + { +public: + enum DIGITAL_PINS : uint8_t + { + PIN_SX1276_NSS = 18, + PIN_SX1276_NRESET = 23, + PIN_SX1276_DIO0 = LORA_DIO0, + PIN_SX1276_DIO1 = LORA_DIO1, + PIN_SX1276_DIO2 = LORA_DIO2, + PIN_SX1276_ANT_SWITCH_RX = HalPinmap_t::UNUSED_PIN, + PIN_SX1276_ANT_SWITCH_TX_BOOST = HalPinmap_t::UNUSED_PIN, + PIN_SX1276_ANT_SWITCH_TX_RFO = HalPinmap_t::UNUSED_PIN, + PIN_VDD_BOOST_ENABLE = HalPinmap_t::UNUSED_PIN, + }; + + virtual void begin(void) override + { + digitalWrite(PIN_SX1276_NSS, 1); + pinMode(PIN_SX1276_NSS, OUTPUT); + } + + // virtual void end(void) override + + // virtual ostime_t setModuleActive(bool state) override + + }; + +static HalConfiguration_ttgo_lora32_v21 myConfig; + +static const HalPinmap_t myPinmap = + { + .nss = HalConfiguration_ttgo_lora32_v21::PIN_SX1276_NSS, // chip select is D7 + .rxtx = HalConfiguration_ttgo_lora32_v21::PIN_SX1276_ANT_SWITCH_RX, // RXTX is D29 + .rst = HalConfiguration_ttgo_lora32_v21::PIN_SX1276_NRESET, // NRESET is D8 + + .dio = {HalConfiguration_ttgo_lora32_v21::PIN_SX1276_DIO0, // DIO0 (IRQ) is D25 + HalConfiguration_ttgo_lora32_v21::PIN_SX1276_DIO1, // DIO1 is D26 + HalConfiguration_ttgo_lora32_v21::PIN_SX1276_DIO2, // DIO2 is D27 + }, + .rxtx_rx_active = 0, + .rssi_cal = 10, + .spi_freq = 8000000, /* 8MHz */ + .pConfig = &myConfig + }; + +const HalPinmap_t * GetPinmap_ttgo_lora32_v21 (void) + { + return &myPinmap; + } + +}; // namespace Arduino_LMIC + + From 436177cc9af55f3341dc6a695e3bc90f3626e68c Mon Sep 17 00:00:00 2001 From: Chrisotph Schultz Date: Sun, 21 Mar 2021 16:50:50 +0100 Subject: [PATCH 2/3] corrected hal/getPinMap_thisboard.cpp --- src/hal/getpinmap_thisboard.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hal/getpinmap_thisboard.cpp b/src/hal/getpinmap_thisboard.cpp index b23d166f..4bffe2fd 100644 --- a/src/hal/getpinmap_thisboard.cpp +++ b/src/hal/getpinmap_thisboard.cpp @@ -55,6 +55,8 @@ const HalPinmap_t *GetPinmap_ThisBoard(void) return GetPinmap_Catena4630(); #elif defined(ARDUINO_MCCI_CATENA_4801) return GetPinmap_Catena4801(); +#elif defined(ARDUINO_MCCI_CATENA_4802) + return GetPinmap_Catena4802(); #elif defined(ARDUINO_DISCO_L072CZ_LRWAN1) return GetPinmap_Disco_L072cz_Lrwan1(); #elif defined(PINNOCHIO_SCOUT) From 2494a8642ccdbed4b7a64e169c932357ca0ca672 Mon Sep 17 00:00:00 2001 From: Christoph Schultz Date: Fri, 13 Aug 2021 10:41:10 +0200 Subject: [PATCH 3/3] added GetPinmap_ttgo_lora32_v21 to src/arduino_lmic_hal_boards.h --- src/arduino_lmic_hal_boards.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/arduino_lmic_hal_boards.h b/src/arduino_lmic_hal_boards.h index 4fc94c6d..34eda3fe 100644 --- a/src/arduino_lmic_hal_boards.h +++ b/src/arduino_lmic_hal_boards.h @@ -37,6 +37,7 @@ const HalPinmap_t *GetPinmap_Catena4630(); const HalPinmap_t *GetPinmap_Catena4801(); const HalPinmap_t *GetPinmap_Catena4802(); const HalPinmap_t* GetPinmap_ttgo_lora32_v1(); +const HalPinmap_t *GetPinmap_ttgo_lora32_v21(); const HalPinmap_t* GetPinmap_heltec_lora32(); const HalPinmap_t* GetPinmap_Disco_L072cz_Lrwan1();