|
| 1 | + |
| 2 | + |
| 3 | +#include <arduino_lmic_hal_boards.h> |
| 4 | +#include <Arduino.h> |
| 5 | + |
| 6 | +#include "../lmic/oslmic.h" |
| 7 | + |
| 8 | +#define LORA_DIO0 26 |
| 9 | +#define LORA_DIO1 33 |
| 10 | +#define LORA_DIO2 32 |
| 11 | + |
| 12 | +namespace Arduino_LMIC { |
| 13 | + |
| 14 | +class HalConfiguration_ttgo_lora32_v21 : public HalConfiguration_t |
| 15 | + { |
| 16 | +public: |
| 17 | + enum DIGITAL_PINS : uint8_t |
| 18 | + { |
| 19 | + PIN_SX1276_NSS = 18, |
| 20 | + PIN_SX1276_NRESET = 23, |
| 21 | + PIN_SX1276_DIO0 = LORA_DIO0, |
| 22 | + PIN_SX1276_DIO1 = LORA_DIO1, |
| 23 | + PIN_SX1276_DIO2 = LORA_DIO2, |
| 24 | + PIN_SX1276_ANT_SWITCH_RX = HalPinmap_t::UNUSED_PIN, |
| 25 | + PIN_SX1276_ANT_SWITCH_TX_BOOST = HalPinmap_t::UNUSED_PIN, |
| 26 | + PIN_SX1276_ANT_SWITCH_TX_RFO = HalPinmap_t::UNUSED_PIN, |
| 27 | + PIN_VDD_BOOST_ENABLE = HalPinmap_t::UNUSED_PIN, |
| 28 | + }; |
| 29 | + |
| 30 | + virtual void begin(void) override |
| 31 | + { |
| 32 | + digitalWrite(PIN_SX1276_NSS, 1); |
| 33 | + pinMode(PIN_SX1276_NSS, OUTPUT); |
| 34 | + } |
| 35 | + |
| 36 | + // virtual void end(void) override |
| 37 | + |
| 38 | + // virtual ostime_t setModuleActive(bool state) override |
| 39 | + |
| 40 | + }; |
| 41 | + |
| 42 | +static HalConfiguration_ttgo_lora32_v21 myConfig; |
| 43 | + |
| 44 | +static const HalPinmap_t myPinmap = |
| 45 | + { |
| 46 | + .nss = HalConfiguration_ttgo_lora32_v21::PIN_SX1276_NSS, // chip select is D7 |
| 47 | + .rxtx = HalConfiguration_ttgo_lora32_v21::PIN_SX1276_ANT_SWITCH_RX, // RXTX is D29 |
| 48 | + .rst = HalConfiguration_ttgo_lora32_v21::PIN_SX1276_NRESET, // NRESET is D8 |
| 49 | + |
| 50 | + .dio = {HalConfiguration_ttgo_lora32_v21::PIN_SX1276_DIO0, // DIO0 (IRQ) is D25 |
| 51 | + HalConfiguration_ttgo_lora32_v21::PIN_SX1276_DIO1, // DIO1 is D26 |
| 52 | + HalConfiguration_ttgo_lora32_v21::PIN_SX1276_DIO2, // DIO2 is D27 |
| 53 | + }, |
| 54 | + .rxtx_rx_active = 0, |
| 55 | + .rssi_cal = 10, |
| 56 | + .spi_freq = 8000000, /* 8MHz */ |
| 57 | + .pConfig = &myConfig |
| 58 | + }; |
| 59 | + |
| 60 | +const HalPinmap_t * GetPinmap_ttgo_lora32_v21 (void) |
| 61 | + { |
| 62 | + return &myPinmap; |
| 63 | + } |
| 64 | + |
| 65 | +}; // namespace Arduino_LMIC |
| 66 | + |
| 67 | + |
0 commit comments