From 72bfee34ee3ff020bac6803399989ea0cc6c429a Mon Sep 17 00:00:00 2001 From: code8buster Date: Sun, 8 May 2022 01:00:01 +0000 Subject: [PATCH] Disaster Radio dev board initial support (#1443) * Initial pin redefs for Disasterradio's prototype pcb * Initializes E22-900M30S correctly, seems to be ready to work * Add new macros for upstream merge * Cleaning up stray experiment That was silly, what was I even thinking? Late evening coding mistakes. --- platformio.ini | 1 + src/configuration.h | 6 +++- variants/diy/dr-dev/variant.h | 68 +++++++++++++++++++++++++++++++++++ variants/diy/platformio.ini | 14 +++++++- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 variants/diy/dr-dev/variant.h diff --git a/platformio.ini b/platformio.ini index eb39e70ab..a21cfc3b4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -29,6 +29,7 @@ default_envs = tbeam ;default_envs = nano-g1 ;default_envs = meshtastic-diy-v1 ;default_envs = meshtastic-diy-v1.1 +;default_envs = meshtastic-dr-dev ; board specific config can be moved to the respective 'variants' file. ; See https://docs.platformio.org/en/latest/projectconf/section_platformio.html#extra-configs diff --git a/src/configuration.h b/src/configuration.h index cb60609ec..c48a279bc 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -169,6 +169,10 @@ along with this program. If not, see . // This string must exactly match the case used in release file names or the android updater won't work #define HW_VENDOR HardwareModel_DIY_V1 +#elif defined(DR_DEV) +// This string must exactly match the case used in release file names or the android updater won't work +#define HW_VENDOR HardwareModel_DR_DEV + #elif defined(RAK_11200) // This string must exactly match the case used in release file names or the android updater won't work #define HW_VENDOR HardwareModel_RAK11200 @@ -254,4 +258,4 @@ along with this program. If not, see . #include "variant.h" #include "RF95Configuration.h" -#include "DebugConfiguration.h" \ No newline at end of file +#include "DebugConfiguration.h" diff --git a/variants/diy/dr-dev/variant.h b/variants/diy/dr-dev/variant.h new file mode 100644 index 000000000..cce65b1d3 --- /dev/null +++ b/variants/diy/dr-dev/variant.h @@ -0,0 +1,68 @@ +// For OLED LCD +#define I2C_SDA 21 +#define I2C_SCL 22 + +// GPS +#undef GPS_RX_PIN +#define GPS_RX_PIN NOT_A_PIN + +#define BUTTON_PIN 2 // The middle button GPIO on the T-Beam +#define BUTTON_NEED_PULLUP +#define EXT_NOTIFY_OUT 12 // Overridden default pin to use for Ext Notify Module (#975). + +#define LORA_DIO0 -1 // a No connect on the SX1262/SX1268 module +#define LORA_RESET -1 // RST for SX1276, and for SX1262/SX1268 +#define LORA_DIO1 27 // IRQ for SX1262/SX1268 (IO26 FOR 22S) +#define LORA_DIO2 NOT_A_PIN // BUSY for SX1262/SX1268 +#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262/SX1268, if DIO3 is high the TXCO is enabled + +// In transmitting, set TXEN as high communication level,RXEN pin is low level; +// In receiving, set RXEN as high communication level, TXEN is lowlevel; +// Before powering off, set TXEN、RXEN as low level. +#define LORA_RXEN 17 // Input - RF switch RX control, connecting external MCU IO, valid in high level +#define LORA_TXEN -1 // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level +/* --PINS FOR THE 900M22S +#undef RF95_SCK +#define RF95_SCK 18 +#undef RF95_MISO +#define RF95_MISO 19 +#undef RF95_MOSI +#define RF95_MOSI 23 +#undef RF95_NSS +#define RF95_NSS 16 +*/ + +// PINS FOR THE 900M30S +#undef RF95_SCK +#define RF95_SCK 18 +#undef RF95_MISO +#define RF95_MISO 19 +#undef RF95_MOSI +#define RF95_MOSI 23 +#undef RF95_NSS +#define RF95_NSS 33 + +// RX/TX for RFM95/SX127x +#define RF95_RXEN LORA_RXEN +#define RF95_TXEN LORA_TXEN +// #define RF95_TCXO + +// common pinouts for SX126X modules +#define SX126X_CS 33 +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY 35 +#define SX126X_RESET LORA_RESET +#define SX126X_RXEN LORA_RXEN +#define SX126X_TXEN LORA_TXEN + +// supported modules list +#define USE_RF95 // RFM95/SX127x +#define USE_SX1262 +#define USE_SX1268 +#define USE_LLCC68 + +#ifdef EBYTE_E22 +// Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch +// (which is the default for the sx1262interface code) +#define SX126X_E22 +#endif diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index 6cd51ee15..0c3982261 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -16,4 +16,16 @@ build_flags = ${esp32_base.build_flags} -D DIY_V1 -D EBYTE_E22 - -I variants/diy/v1_1 \ No newline at end of file + -I variants/diy/v1_1 + +; Port to Disaster Radio's ESP32-v3 Dev Board +[env:meshtastic-dr-dev] +extends = esp32_base +board = esp32doit-devkit-v1 +board_upload.maximum_size = 4194304 +board_upload.maximum_ram_size = 532480 +build_flags = + ${esp32_base.build_flags} + -D DR_DEV + -D EBYTE_E22 + -I variants/diy/dr-dev