From 67bad9a689e21f3e6406061b392c44773dfb9d0e Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 16 Aug 2020 14:20:05 -0700 Subject: [PATCH] Add SX1262 to @BigCorvus board --- variants/lora_relay_v1/variant.cpp | 28 +++++++++---------- variants/lora_relay_v1/variant.h | 45 +++++++++++++++--------------- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/variants/lora_relay_v1/variant.cpp b/variants/lora_relay_v1/variant.cpp index 03ac587a..dd275021 100644 --- a/variants/lora_relay_v1/variant.cpp +++ b/variants/lora_relay_v1/variant.cpp @@ -39,16 +39,16 @@ const uint32_t g_ADigitalPinMap[] = { 6, // D11 is P0.06 D_RES (IPS display reset) 8, // D12 is P0.08 D_CS (IPS display chip select) 41, // D13 is P1.09 BLT (IPS display backlight) + 4, // D14 is P0.04 SX1262 RXEN // D14 .. D21 (aka A0 .. A7) - 4, // D14 is P0.04 (A0) - 5, // D15 is P0.05 (A1) - 30, // D16 is P0.30 (A2) - 28, // D17 is P0.28 (A3) - 2, // D18 is P0.02 (A4) - 3, // D19 is P0.03 (A5) - 29, // D20 is P0.29 (A6, Battery) - 31, // D21 is P0.31 (A7, ARef) + 5, // D15 is P0.05 (A0) + 30, // D16 is P0.30 (A1) + 28, // D17 is P0.28 (A2) + 2, // D18 is P0.02 (A3) + 3, // D19 is P0.03 (A4) + 29, // D20 is P0.29 (A5, Battery) + 31, // D21 is P0.31 (A6, ARef) // D22 .. D23 (aka I2C pins) 12, // D22 is P0.12 (SDA) @@ -77,19 +77,19 @@ const uint32_t g_ADigitalPinMap[] = { // 32, // P1.00 is SWO (attached to debug header) // D29-D43 - 27, // P0.27 E22-SX1262 DIO1 - 28, // P0.28 E22-SX1262 DIO2 - 30, // P0.30 E22-SX1262 TXEN + 27, // D29 P0.27 E22-SX1262 DIO1 + 28, // D30 P0.28 E22-SX1262 DIO2 + 30, // D31 P0.30 E22-SX1262 TXEN + 35, // D32 P1.03 E22-SX1262 NSS + 32 + 8, // D33 P1.08 E22-SX1262 BUSY + 32 + 12, // D34 P1.12 E22-SX1262 RESET 32 + 1, // P1.01 BTN_UP 32 + 2, // P1.02 SWITCH - 35, // P1.03 E22-SX1262 NSS 36, // P1.04 is not connected per schematic 37, // P1.05 is not connected per schematic 38, // P1.06 is not connected per schematic 39, // P1.07 is not connected per schematic - 32 + 8, // P1.08 E22-SX1262 BUSY 43, // P1.11 is not connected per schematic - 32 + 12, // P1.12 E22-SX1262 RESET 45, // P1.13 is not connected per schematic 46, // P1.14 is not connected per schematic }; diff --git a/variants/lora_relay_v1/variant.h b/variants/lora_relay_v1/variant.h index 06e59d02..fbf64c28 100644 --- a/variants/lora_relay_v1/variant.h +++ b/variants/lora_relay_v1/variant.h @@ -38,7 +38,7 @@ extern "C" { // Number of pins defined in PinDescription array #define PINS_COUNT (43) #define NUM_DIGITAL_PINS (43) -#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference +#define NUM_ANALOG_INPUTS (7) // A6 is used for battery, A7 is analog reference #define NUM_ANALOG_OUTPUTS (0) // LEDs @@ -62,14 +62,13 @@ extern "C" { /* * Analog pins */ -#define PIN_A0 (14) -#define PIN_A1 (15) -#define PIN_A2 (16) -#define PIN_A3 (17) -#define PIN_A4 (18) -#define PIN_A5 (19) -#define PIN_A6 (20) -#define PIN_A7 (21) +#define PIN_A0 (15) +#define PIN_A1 (16) +#define PIN_A2 (17) +#define PIN_A3 (18) +#define PIN_A4 (19) +#define PIN_A5 (20) +#define PIN_A6 (21) static const uint8_t A0 = PIN_A0; static const uint8_t A1 = PIN_A1; @@ -78,12 +77,12 @@ static const uint8_t A3 = PIN_A3; static const uint8_t A4 = PIN_A4; static const uint8_t A5 = PIN_A5; static const uint8_t A6 = PIN_A6; -static const uint8_t A7 = PIN_A7; +// static const uint8_t A7 = PIN_A7; #define ADC_RESOLUTION 14 // Other pins -#define PIN_AREF PIN_A7 -#define PIN_VBAT PIN_A6 +#define PIN_AREF PIN_A6 +#define PIN_VBAT PIN_A5 #define PIN_NFC1 (33) #define PIN_NFC2 (2) @@ -117,17 +116,19 @@ static const uint8_t SCK = PIN_SPI_SCK; #define PIN_WIRE_SDA (22) #define PIN_WIRE_SCL (23) -// QSPI Pins -//#define PIN_QSPI_SCK 27 -//#define PIN_QSPI_CS 28 -//#define PIN_QSPI_IO0 29 -//#define PIN_QSPI_IO1 30 -//#define PIN_QSPI_IO2 31 -//#define PIN_QSPI_IO3 32 +// I2C device addresses +#define I2C_ADDR_BQ27441 0x55 // Battery gauge -// On-board QSPI Flash -//#define EXTERNAL_FLASH_DEVICES GD25Q16C -//#define EXTERNAL_FLASH_USE_QSPI +// CUSTOM GPIOs the SX1262 +#define SX1262_CS (32) +#define SX1262_DIO1 (29) +#define SX1262_DIO2 (30) +#define SX1262_BUSY (33) // Supposed to be P0.18 but because of reworks, now on P0.31 (18) +#define SX1262_RESET (34) +// #define SX1262_ANT_SW (32 + 10) +#define SX1262_RXEN (14) +#define SX1262_TXEN (31) +#define SX1262_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that #ifdef __cplusplus }