Compare commits
10 Commits
20b51104a1
...
0f29d1b65e
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0f29d1b65e | ||
![]() |
283d2176bd | ||
![]() |
fc8dd54848 | ||
![]() |
49fb916fd3 | ||
![]() |
eaf5f0682f | ||
![]() |
06aa6721f8 | ||
![]() |
a39357d332 | ||
![]() |
1d62fdd52e | ||
![]() |
accb5d907c | ||
![]() |
e9660ae595 |
435
Boards.h
435
Boards.h
@@ -161,11 +161,9 @@
|
||||
#endif
|
||||
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
|
||||
// Board models for ESP32 based builds are
|
||||
// defined by the build target in the makefile.
|
||||
// If you are not using make to compile this
|
||||
// firmware, you can manually define model here.
|
||||
// Board models for ESP32 based builds are defined by the build target in
|
||||
// the makefile. If you are not using make to compile this firmware, you
|
||||
// can manually define the model here.
|
||||
//
|
||||
// #define BOARD_MODEL BOARD_GENERIC_ESP32
|
||||
#define CONFIG_UART_BUFFER_SIZE 6144
|
||||
@@ -186,7 +184,7 @@
|
||||
#define INTERFACE_COUNT 1
|
||||
const int pin_led_rx = 14;
|
||||
const int pin_led_tx = 32;
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX127X};
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1276};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX127X
|
||||
{
|
||||
@@ -229,7 +227,7 @@
|
||||
const int pin_led_tx = 4;
|
||||
|
||||
#if BOARD_VARIANT == MODEL_E4 || BOARD_VARIANT == MODEL_E9
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX127X};
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1276};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX127X
|
||||
{
|
||||
@@ -290,7 +288,7 @@
|
||||
const int pin_led_rx = 14;
|
||||
const int pin_led_tx = 32;
|
||||
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX127X};
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1276};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX127X
|
||||
{
|
||||
@@ -300,7 +298,7 @@
|
||||
},
|
||||
};
|
||||
const int8_t interface_pins[INTERFACE_COUNT][10] = {
|
||||
// SX1262
|
||||
// SX127X
|
||||
{
|
||||
4, // pin_ss
|
||||
-1, // pin_sclk
|
||||
@@ -377,7 +375,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX127X};
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1276};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX127X
|
||||
{
|
||||
@@ -494,7 +492,7 @@
|
||||
const int pin_led_tx = 25;
|
||||
#endif
|
||||
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX127X};
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1276};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX127X
|
||||
{
|
||||
@@ -707,7 +705,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX127X};
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1276};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX127X
|
||||
{
|
||||
@@ -732,8 +730,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
// todo ce-ise all boards below here
|
||||
|
||||
#elif BOARD_MODEL == BOARD_T3S3
|
||||
#define IS_ESP32S3 true
|
||||
#define HAS_DISPLAY true
|
||||
@@ -754,7 +750,7 @@
|
||||
#define INTERFACE_COUNT 1
|
||||
const int pin_btn_usr1 = 0;
|
||||
|
||||
#if BOARD_VARIANT == MODEL_A1
|
||||
#if BOARD_VARIANT == MODEL_A1 || BOARD_VARIANT == MODEL_A6
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1262};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX1262
|
||||
@@ -779,6 +775,31 @@
|
||||
-1 // pin_tcxo_enable
|
||||
}
|
||||
};
|
||||
#elif BOARD_VARIANT == MODEL_A5 || BOARD_VARIANT == MODEL_AA
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1278};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX1278
|
||||
{
|
||||
false, // DEFAULT_SPI
|
||||
false, // HAS_TCXO
|
||||
false // DIO2_AS_RF_SWITCH
|
||||
},
|
||||
};
|
||||
const uint8_t interface_pins[INTERFACE_COUNT][10] = {
|
||||
// SX1278
|
||||
{
|
||||
7, // pin_ss
|
||||
5, // pin_sclk
|
||||
6, // pin_mosi
|
||||
3, // pin_miso
|
||||
34, // pin_busy
|
||||
33, // pin_dio
|
||||
8, // pin_reset
|
||||
-1, // pin_txen
|
||||
-1, // pin_rxen
|
||||
-1 // pin_tcxo_enable
|
||||
}
|
||||
};
|
||||
#elif BOARD_VARIANT == MODEL_AC // SX1280 with PA
|
||||
#define CONFIG_QUEUE_0_SIZE 6144
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1280};
|
||||
@@ -828,24 +849,22 @@
|
||||
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
#define IS_ESP32S3 true
|
||||
#define MODEM SX1262
|
||||
#define DIO2_AS_RF_SWITCH true
|
||||
#define HAS_BUSY true
|
||||
#define HAS_TCXO true
|
||||
|
||||
#define HAS_DISPLAY false
|
||||
#define HAS_CONSOLE false
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
#define HAS_PMU true
|
||||
#define HAS_NP false
|
||||
#define HAS_SD false
|
||||
#define HAS_EEPROM true
|
||||
|
||||
#define HAS_INPUT true
|
||||
#define HAS_SLEEP true
|
||||
#define PIN_WAKEUP GPIO_NUM_0
|
||||
#define WAKEUP_LEVEL 0
|
||||
|
||||
const int pin_poweron = 10;
|
||||
const int pin_btn_usr1 = 0;
|
||||
|
||||
const int pin_cs = 9;
|
||||
const int pin_reset = 17;
|
||||
const int pin_sclk = 40;
|
||||
const int pin_mosi = 41;
|
||||
const int pin_miso = 38;
|
||||
const int pin_tcxo_enable = -1;
|
||||
const int pin_dio = 45;
|
||||
const int pin_busy = 13;
|
||||
|
||||
const int SD_MISO = 38;
|
||||
const int SD_MOSI = 41;
|
||||
@@ -859,6 +878,33 @@
|
||||
const int DISPLAY_CLK = 40;
|
||||
const int DISPLAY_BL_PIN = 42;
|
||||
|
||||
#define INTERFACE_COUNT 1
|
||||
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1262};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX1262
|
||||
{
|
||||
false, // DEFAULT_SPI
|
||||
true, // HAS_TCXO
|
||||
true // DIO2_AS_RF_SWITCH
|
||||
},
|
||||
};
|
||||
const uint8_t interface_pins[INTERFACE_COUNT][10] = {
|
||||
// SX1262
|
||||
{
|
||||
9, // pin_ss
|
||||
40, // pin_sclk
|
||||
41, // pin_mosi
|
||||
38, // pin_miso
|
||||
13, // pin_busy
|
||||
45, // pin_dio
|
||||
17, // pin_reset
|
||||
-1, // pin_txen
|
||||
-1, // pin_rxen
|
||||
-1 // pin_tcxo_enable
|
||||
}
|
||||
};
|
||||
|
||||
#if HAS_NP == false
|
||||
#if defined(EXTERNAL_LEDS)
|
||||
const int pin_led_rx = 43;
|
||||
@@ -871,13 +917,10 @@
|
||||
|
||||
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
|
||||
#define IS_ESP32S3 true
|
||||
#define MODEM SX1262
|
||||
#define DIO2_AS_RF_SWITCH true
|
||||
#define HAS_BUSY true
|
||||
#define HAS_TCXO true
|
||||
#define OCP_TUNED 0x38
|
||||
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY MONO_OLED
|
||||
#define HAS_CONSOLE true
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
@@ -894,15 +937,6 @@
|
||||
#define I2C_SDA 42
|
||||
|
||||
const int pin_btn_usr1 = 0;
|
||||
|
||||
const int pin_cs = 10;
|
||||
const int pin_reset = 5;
|
||||
const int pin_sclk = 12;
|
||||
const int pin_mosi = 11;
|
||||
const int pin_miso = 13;
|
||||
const int pin_tcxo_enable = -1;
|
||||
const int pin_dio = 1;
|
||||
const int pin_busy = 4;
|
||||
|
||||
const int SD_MISO = 37;
|
||||
const int SD_MOSI = 35;
|
||||
@@ -911,17 +945,8 @@
|
||||
|
||||
const int IMU_CS = 34;
|
||||
|
||||
#if HAS_NP == false
|
||||
#if defined(EXTERNAL_LEDS)
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#else
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#endif
|
||||
#endif
|
||||
#define INTERFACE_COUNT 1
|
||||
|
||||
#if BOARD_VARIANT == MODEL_A1
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1262};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX1262
|
||||
@@ -934,52 +959,36 @@
|
||||
const uint8_t interface_pins[INTERFACE_COUNT][10] = {
|
||||
// SX1262
|
||||
{
|
||||
7, // pin_ss
|
||||
5, // pin_sclk
|
||||
6, // pin_mosi
|
||||
3, // pin_miso
|
||||
34, // pin_busy
|
||||
33, // pin_dio
|
||||
8, // pin_reset
|
||||
10, // pin_ss
|
||||
12, // pin_sclk
|
||||
11, // pin_mosi
|
||||
13, // pin_miso
|
||||
4, // pin_busy
|
||||
1, // pin_dio
|
||||
5, // pin_reset
|
||||
-1, // pin_txen
|
||||
-1, // pin_rxen
|
||||
-1 // pin_tcxo_enable
|
||||
}
|
||||
};
|
||||
#elif BOARD_VARIANT == MODEL_AC // SX1280 with PA
|
||||
#define CONFIG_UART_BUFFER_SIZE 40000
|
||||
#define CONFIG_QUEUE_0_SIZE 40000
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1280};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX1280
|
||||
{
|
||||
false, // DEFAULT_SPI
|
||||
false, // HAS_TCXO
|
||||
false // DIO2_AS_RF_SWITCH
|
||||
},
|
||||
};
|
||||
const uint8_t interface_pins[INTERFACE_COUNT][10] = {
|
||||
// SX1280
|
||||
{
|
||||
7, // pin_ss
|
||||
5, // pin_sclk
|
||||
6, // pin_mosi
|
||||
3, // pin_miso
|
||||
36, // pin_busy
|
||||
9, // pin_dio
|
||||
8, // pin_reset
|
||||
10, // pin_txen
|
||||
21, // pin_rxen
|
||||
-1 // pin_tcxo_enable
|
||||
}
|
||||
};
|
||||
|
||||
#if HAS_NP == false
|
||||
#if defined(EXTERNAL_LEDS)
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#else
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif BOARD_MODEL == BOARD_E22_ESP32
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY OLED
|
||||
// currently there is only support for using one Bluetooth type,
|
||||
// Bluetooth has been chosen over BLE as it is less experimental
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_BLE true
|
||||
//#define HAS_BLE true
|
||||
#define HAS_CONSOLE true
|
||||
#define HAS_SD false
|
||||
#define HAS_EEPROM true
|
||||
@@ -1013,116 +1022,15 @@
|
||||
-1 // pin_tcxo_enable
|
||||
}
|
||||
};
|
||||
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
#define IS_ESP32S3 true
|
||||
#define MODEM SX1262
|
||||
#define DIO2_AS_RF_SWITCH true
|
||||
#define HAS_BUSY true
|
||||
#define HAS_TCXO true
|
||||
|
||||
#define HAS_DISPLAY false
|
||||
#define HAS_CONSOLE false
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
#define HAS_PMU true
|
||||
#define HAS_NP false
|
||||
#define HAS_SD false
|
||||
#define HAS_EEPROM true
|
||||
|
||||
#define HAS_INPUT true
|
||||
#define HAS_SLEEP true
|
||||
#define PIN_WAKEUP GPIO_NUM_0
|
||||
#define WAKEUP_LEVEL 0
|
||||
|
||||
const int pin_poweron = 10;
|
||||
const int pin_btn_usr1 = 0;
|
||||
|
||||
const int pin_cs = 9;
|
||||
const int pin_reset = 17;
|
||||
const int pin_sclk = 40;
|
||||
const int pin_mosi = 41;
|
||||
const int pin_miso = 38;
|
||||
const int pin_tcxo_enable = -1;
|
||||
const int pin_dio = 45;
|
||||
const int pin_busy = 13;
|
||||
|
||||
const int SD_MISO = 38;
|
||||
const int SD_MOSI = 41;
|
||||
const int SD_CLK = 40;
|
||||
const int SD_CS = 39;
|
||||
|
||||
const int DISPLAY_DC = 11;
|
||||
const int DISPLAY_CS = 12;
|
||||
const int DISPLAY_MISO = 38;
|
||||
const int DISPLAY_MOSI = 41;
|
||||
const int DISPLAY_CLK = 40;
|
||||
const int DISPLAY_BL_PIN = 42;
|
||||
|
||||
#if HAS_NP == false
|
||||
#if defined(EXTERNAL_LEDS)
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#else
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
|
||||
#define IS_ESP32S3 true
|
||||
#define MODEM SX1262
|
||||
#define DIO2_AS_RF_SWITCH true
|
||||
#define HAS_BUSY true
|
||||
#define HAS_TCXO true
|
||||
|
||||
#define HAS_DISPLAY true
|
||||
#define HAS_CONSOLE true
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
#define HAS_PMU true
|
||||
#define HAS_NP false
|
||||
#define HAS_SD false
|
||||
#define HAS_EEPROM true
|
||||
|
||||
#define HAS_INPUT true
|
||||
#define HAS_SLEEP false
|
||||
|
||||
#define PMU_IRQ 40
|
||||
#define I2C_SCL 41
|
||||
#define I2C_SDA 42
|
||||
|
||||
const int pin_btn_usr1 = 0;
|
||||
|
||||
const int pin_cs = 10;
|
||||
const int pin_reset = 5;
|
||||
const int pin_sclk = 12;
|
||||
const int pin_mosi = 11;
|
||||
const int pin_miso = 13;
|
||||
const int pin_tcxo_enable = -1;
|
||||
const int pin_dio = 1;
|
||||
const int pin_busy = 4;
|
||||
|
||||
const int SD_MISO = 37;
|
||||
const int SD_MOSI = 35;
|
||||
const int SD_CLK = 36;
|
||||
const int SD_CS = 47;
|
||||
|
||||
const int IMU_CS = 34;
|
||||
|
||||
#if HAS_NP == false
|
||||
#if defined(EXTERNAL_LEDS)
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#else
|
||||
const int pin_led_rx = 43;
|
||||
const int pin_led_tx = 43;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error An unsupported ESP32 board was selected. Cannot compile RNode firmware.
|
||||
#endif
|
||||
|
||||
#elif MCU_VARIANT == MCU_NRF52
|
||||
#define CONFIG_UART_BUFFER_SIZE 6144
|
||||
#define CONFIG_QUEUE_0_SIZE 6144
|
||||
#define CONFIG_QUEUE_MAX_LENGTH 200
|
||||
|
||||
#if BOARD_MODEL == BOARD_TECHO
|
||||
#define _PINNUM(port, pin) ((port) * 32 + (pin))
|
||||
#define HAS_INPUT true
|
||||
@@ -1315,71 +1223,12 @@
|
||||
const int pin_led_rx = LED_BLUE;
|
||||
const int pin_led_tx = LED_GREEN;
|
||||
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
#define _PINNUM(port, pin) ((port) * 32 + (pin))
|
||||
#define MODEM SX1262
|
||||
#define HAS_EEPROM false
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
#define HAS_CONSOLE false
|
||||
#define HAS_PMU true
|
||||
#define HAS_NP false
|
||||
#define HAS_SD false
|
||||
#define HAS_TCXO true
|
||||
#define HAS_BUSY true
|
||||
#define HAS_INPUT true
|
||||
#define HAS_SLEEP true
|
||||
#define BLE_MANUFACTURER "LilyGO"
|
||||
#define BLE_MODEL "T-Echo"
|
||||
|
||||
#define HAS_INPUT true
|
||||
#define EEPROM_SIZE 296
|
||||
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
||||
|
||||
#define CONFIG_UART_BUFFER_SIZE 32768
|
||||
#define CONFIG_QUEUE_SIZE 6144
|
||||
#define CONFIG_QUEUE_MAX_LENGTH 200
|
||||
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY EINK_BW
|
||||
#define HAS_BACKLIGHT true
|
||||
#define DISPLAY_SCALE 1
|
||||
|
||||
#define LED_ON LOW
|
||||
#define LED_OFF HIGH
|
||||
#define PIN_LED_GREEN _PINNUM(1, 1)
|
||||
#define PIN_LED_RED _PINNUM(1, 3)
|
||||
#define PIN_LED_BLUE _PINNUM(0, 14)
|
||||
#define PIN_VEXT_EN _PINNUM(0, 12)
|
||||
|
||||
const int pin_disp_cs = 30;
|
||||
const int pin_disp_dc = 28;
|
||||
const int pin_disp_reset = 2;
|
||||
const int pin_disp_busy = 3;
|
||||
const int pin_disp_en = -1;
|
||||
const int pin_disp_sck = 31;
|
||||
const int pin_disp_mosi = 29;
|
||||
const int pin_disp_miso = -1;
|
||||
const int pin_backlight = 43;
|
||||
|
||||
const int pin_btn_usr1 = _PINNUM(1, 10);
|
||||
const int pin_btn_touch = _PINNUM(0, 11);
|
||||
|
||||
const int pin_reset = 25;
|
||||
const int pin_cs = 24;
|
||||
const int pin_sclk = 19;
|
||||
const int pin_mosi = 22;
|
||||
const int pin_miso = 23;
|
||||
const int pin_busy = 17;
|
||||
const int pin_dio = 20;
|
||||
const int pin_tcxo_enable = 21;
|
||||
const int pin_led_rx = PIN_LED_BLUE;
|
||||
const int pin_led_tx = PIN_LED_RED;
|
||||
|
||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
#define MODEM SX1262
|
||||
#define HAS_EEPROM false
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY TFT
|
||||
#define DISPLAY_SCALE_OVERRIDE true
|
||||
#define DISPLAY_SCALE 2
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
#define HAS_CONSOLE false
|
||||
@@ -1408,53 +1257,51 @@
|
||||
#define NP_M 1
|
||||
const int pin_np = PIN_T114_LED;
|
||||
|
||||
// SPI
|
||||
#define PIN_T114_MOSI 22
|
||||
#define PIN_T114_MISO 23
|
||||
#define PIN_T114_SCK 19
|
||||
#define PIN_T114_SS 24
|
||||
|
||||
// SX1262
|
||||
#define PIN_T114_RST 25
|
||||
#define PIN_T114_DIO1 20
|
||||
#define PIN_T114_BUSY 17
|
||||
|
||||
// TFT
|
||||
#define DISPLAY_SCALE_OVERRIDE true
|
||||
#define DISPLAY_SCALE 2
|
||||
#define PIN_T114_TFT_MOSI 9
|
||||
#define PIN_T114_TFT_MISO 11 // not connected
|
||||
#define PIN_T114_TFT_SCK 8
|
||||
#define PIN_T114_TFT_SS 11
|
||||
#define PIN_T114_TFT_DC 12
|
||||
#define PIN_T114_TFT_RST 2
|
||||
#define PIN_T114_TFT_EN 3
|
||||
#define PIN_T114_TFT_BLGT 15
|
||||
|
||||
// pins for buttons on Heltec T114
|
||||
const int pin_btn_usr1 = 42;
|
||||
|
||||
// pins for sx1262 on Heltec T114
|
||||
const int pin_reset = PIN_T114_RST;
|
||||
const int pin_cs = PIN_T114_SS;
|
||||
const int pin_sclk = PIN_T114_SCK;
|
||||
const int pin_mosi = PIN_T114_MOSI;
|
||||
const int pin_miso = PIN_T114_MISO;
|
||||
const int pin_busy = PIN_T114_BUSY;
|
||||
const int pin_dio = PIN_T114_DIO1;
|
||||
const int pin_led_rx = 35;
|
||||
const int pin_led_tx = 35;
|
||||
const int pin_tcxo_enable = -1;
|
||||
|
||||
#define PIN_T114_TFT_BLGT 15
|
||||
#define PIN_T114_TFT_EN 3
|
||||
|
||||
// pins for ST7789 display on Heltec T114
|
||||
const int DISPLAY_DC = PIN_T114_TFT_DC;
|
||||
const int DISPLAY_CS = PIN_T114_TFT_SS;
|
||||
const int DISPLAY_MISO = PIN_T114_TFT_MISO;
|
||||
const int DISPLAY_MOSI = PIN_T114_TFT_MOSI;
|
||||
const int DISPLAY_CLK = PIN_T114_TFT_SCK;
|
||||
const int DISPLAY_DC = 12;
|
||||
const int DISPLAY_CS = 11;
|
||||
const int DISPLAY_MISO = 11;
|
||||
const int DISPLAY_MOSI = 9;
|
||||
const int DISPLAY_CLK = 8;
|
||||
const int DISPLAY_BL_PIN = PIN_T114_TFT_BLGT;
|
||||
const int DISPLAY_RST = PIN_T114_TFT_RST;
|
||||
const int DISPLAY_RST = 2;
|
||||
|
||||
#define INTERFACE_COUNT 1
|
||||
|
||||
const uint8_t interfaces[INTERFACE_COUNT] = {SX1262};
|
||||
const bool interface_cfg[INTERFACE_COUNT][3] = {
|
||||
// SX1262
|
||||
{
|
||||
false, // DEFAULT_SPI
|
||||
true, // HAS_TCXO
|
||||
true // DIO2_AS_RF_SWITCH
|
||||
}
|
||||
};
|
||||
const int8_t interface_pins[INTERFACE_COUNT][10] = {
|
||||
// SX1262
|
||||
{
|
||||
24, // pin_ss
|
||||
19, // pin_sclk
|
||||
22, // pin_mosi
|
||||
23, // pin_miso
|
||||
17, // pin_busy
|
||||
20, // pin_dio
|
||||
25, // pin_reset
|
||||
-1, // pin_txen
|
||||
-1, // pin_rxen
|
||||
-1 // pin_tcxo_enable
|
||||
}
|
||||
};
|
||||
#else
|
||||
#error An unsupported nRF board was selected. Cannot compile RNode firmware.
|
||||
#endif
|
||||
|
20
Display.h
20
Display.h
@@ -15,13 +15,14 @@
|
||||
|
||||
#include <Adafruit_GFX.h>
|
||||
|
||||
#define DISP_W 128
|
||||
#define DISP_H 64
|
||||
|
||||
#if DISPLAY == OLED
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#define DISPLAY_BLACK SSD1306_BLACK
|
||||
#define DISPLAY_WHITE SSD1306_WHITE
|
||||
#define DISP_W 128
|
||||
#define DISP_H 64
|
||||
|
||||
#elif DISPLAY == EINK_BW || DISPLAY == EINK_3C
|
||||
void (*display_callback)();
|
||||
@@ -33,15 +34,21 @@ void busyCallback(const void* p) { display_callback(); }
|
||||
#elif DISPLAY == ADAFRUIT_TFT
|
||||
// t-deck
|
||||
#include <Adafruit_ST7789.h>
|
||||
#define DISPLAY_WHITE ST77XX_WHITE
|
||||
#define DISPLAY_BLACK ST77XX_BLACK
|
||||
|
||||
#elif DISPLAY == TFT
|
||||
// t114
|
||||
#include "ST7789.h"
|
||||
//#define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3))
|
||||
#include "src/display/ST7789.h"
|
||||
#define DISPLAY_WHITE ST77XX_WHITE
|
||||
#define DISPLAY_BLACK ST77XX_BLACK
|
||||
#define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3))
|
||||
|
||||
#elif DISPLAY == MONO_OLED
|
||||
// tbeam_s
|
||||
#include <Adafruit_SH110X.h>
|
||||
#define DISPLAY_WHITE SH110X_WHITE
|
||||
#define DISPLAY_BLACK SH110X_BLACK
|
||||
#endif
|
||||
|
||||
#if DISPLAY == EINK_BW
|
||||
@@ -295,7 +302,7 @@ uint8_t display_contrast = 0x00;
|
||||
}
|
||||
level = value;
|
||||
}
|
||||
#elif BOARD_MODEL == BOARD_OPENCOM_XL || BOARD_MODEL == BOARD_H_W_PAPER
|
||||
#elif BOARD_MODEL == BOARD_OPENCOM_XL || BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_H_W_PAPER
|
||||
// no backlight on these displays
|
||||
void set_contrast (void* display, uint8_t contrast) {};
|
||||
#else
|
||||
@@ -858,7 +865,7 @@ void update_stat_area() {
|
||||
drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), DISPLAY_WHITE, DISPLAY_BLACK);
|
||||
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
|
||||
drawBitmap(p_as_x+2, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), DISPLAY_WHITE, DISPLAY_BLACK);
|
||||
if (device_init_done && !disp_ext_fb) display.drawLine(p_as_x, 0, p_as_x, DISP_W/2, DISPLAY_WHITE);
|
||||
if (device_init_done && !disp_ext_fb) drawLine(p_as_x, 0, p_as_x, DISP_W/2, DISPLAY_WHITE);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -1047,7 +1054,6 @@ void update_disp_area() {
|
||||
drawBitmap(p_ad_x, p_ad_y, disp_area.getBuffer(), disp_area.width(), disp_area.height(), DISPLAY_WHITE, DISPLAY_BLACK);
|
||||
if (disp_mode == DISP_MODE_LANDSCAPE) {
|
||||
if (device_init_done && !firmware_update_mode && !disp_ext_fb) {
|
||||
//display.drawLine(0, 0, 0, 63, DISPLAY_WHITE);
|
||||
drawLine(0, 0, 0, 63, DISPLAY_WHITE);
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#define SX1276 0x00
|
||||
#define SX1278 0x01
|
||||
#define SX1262 0x10
|
||||
#define SX1261 0x10
|
||||
#define SX1262 0x11
|
||||
#define SX1268 0x12
|
||||
#define SX1280 0x20
|
||||
|
68
Makefile
68
Makefile
@@ -279,7 +279,7 @@ release-tbeam: check_bt_buffers
|
||||
rm -r build
|
||||
|
||||
release-tbeam_sx1262: check_bt_buffers
|
||||
arduino-cli compile --fqbn esp32:esp32:t-beam $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DBOARD_MODEL=E8\""
|
||||
arduino-cli compile --fqbn esp32:esp32:t-beam $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DBOARD_VARIANT=0xE8\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_tbeam_sx1262.boot_app0
|
||||
cp build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.bin build/rnode_firmware_tbeam_sx1262.bin
|
||||
cp build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_tbeam_sx1262.bootloader
|
||||
@@ -409,25 +409,7 @@ release-techo:
|
||||
rm -r build
|
||||
|
||||
release-t3s3:
|
||||
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_MODEL=0xAB\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3.boot_app0
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3.bin
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3.bootloader
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_t3s3.partitions
|
||||
zip --junk-paths ./Release/rnode_firmware_t3s3.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3.boot_app0 build/rnode_firmware_t3s3.bin build/rnode_firmware_t3s3.bootloader build/rnode_firmware_t3s3.partitions
|
||||
rm -r build
|
||||
|
||||
release-e22_esp32:
|
||||
arduino-cli compile --fqbn esp32:esp32:esp32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x44\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_esp32_e22.boot_app0
|
||||
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bin build/rnode_firmware_esp32_e22.bin
|
||||
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_esp32_e22.bootloader
|
||||
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_esp32_e22.partitions
|
||||
zip --junk-paths ./Release/rnode_firmware_esp32_e22.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_esp32_e22.boot_app0 build/rnode_firmware_esp32_e22.bin build/rnode_firmware_esp32_e22.bootloader build/rnode_firmware_esp32_e22.partitions
|
||||
rm -r build
|
||||
|
||||
release-t3s3_sx126x:
|
||||
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_MODEL=0xA1\""
|
||||
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_VARIANT=0xA1\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3_sx126x.boot_app0
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3_sx126x.bin
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3_sx126x.bootloader
|
||||
@@ -435,6 +417,33 @@ release-t3s3_sx126x:
|
||||
zip --junk-paths ./Release/rnode_firmware_t3s3_sx126x.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx126x.boot_app0 build/rnode_firmware_t3s3_sx126x.bin build/rnode_firmware_t3s3_sx126x.bootloader build/rnode_firmware_t3s3_sx126x.partitions
|
||||
rm -r build
|
||||
|
||||
release-t3s3_sx127x:
|
||||
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_VARIANT=0xA5\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3_sx127x.boot_app0
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3_sx127x.bin
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3_sx127x.bootloader
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_t3s3_sx127x.partitions
|
||||
zip --junk-paths ./Release/rnode_firmware_t3s3_sx127x.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx127x.boot_app0 build/rnode_firmware_t3s3_sx127x.bin build/rnode_firmware_t3s3_sx127x.bootloader build/rnode_firmware_t3s3_sx127x.partitions
|
||||
rm -r build
|
||||
|
||||
release-t3s3_sx1280_pa:
|
||||
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_VARIANT=0xAC\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3_sx1280_pa.boot_app0
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3_sx1280_pa.bin
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3_sx1280_pa.bootloader
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_t3s3_sx1280_pa.partitions
|
||||
zip --junk-paths ./Release/rnode_firmware_t3s3_sx1280_pa.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx1280_pa.boot_app0 build/rnode_firmware_t3s3_sx1280_pa.bin build/rnode_firmware_t3s3_sx1280_pa.bootloader build/rnode_firmware_t3s3_sx1280_pa.partitions
|
||||
rm -r build
|
||||
|
||||
release-e22_esp32:
|
||||
arduino-cli compile --fqbn esp32:esp32:esp32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x45\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_esp32_e22.boot_app0
|
||||
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bin build/rnode_firmware_esp32_e22.bin
|
||||
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_esp32_e22.bootloader
|
||||
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_esp32_e22.partitions
|
||||
zip --junk-paths ./Release/rnode_firmware_esp32_e22.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_esp32_e22.boot_app0 build/rnode_firmware_esp32_e22.bin build/rnode_firmware_esp32_e22.bootloader build/rnode_firmware_esp32_e22.partitions
|
||||
rm -r build
|
||||
|
||||
release-tdeck:
|
||||
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3B\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_tdeck.boot_app0
|
||||
@@ -444,24 +453,6 @@ release-tdeck:
|
||||
zip --junk-paths ./Release/rnode_firmware_tdeck.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_tdeck.boot_app0 build/rnode_firmware_tdeck.bin build/rnode_firmware_tdeck.bootloader build/rnode_firmware_tdeck.partitions
|
||||
rm -r build
|
||||
|
||||
release-t3s3_sx1280_pa:
|
||||
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DMODEM=0x04\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3_sx1280_pa.boot_app0
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3_sx1280_pa.bin
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3_sx1280_pa.bootloader
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_t3s3_sx1280_pa.partitions
|
||||
zip --junk-paths ./Release/rnode_firmware_t3s3_sx1280_pa.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx1280_pa.boot_app0 build/rnode_firmware_t3s3_sx1280_pa.bin build/rnode_firmware_t3s3_sx1280_pa.bootloader build/rnode_firmware_t3s3_sx1280_pa.partitions
|
||||
rm -r build
|
||||
|
||||
release-t3s3_sx127x:
|
||||
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DMODEM=0x01\""
|
||||
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3_sx127x.boot_app0
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3_sx127x.bin
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3_sx127x.bootloader
|
||||
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_t3s3_sx127x.partitions
|
||||
zip --junk-paths ./Release/rnode_firmware_t3s3_sx127x.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx127x.boot_app0 build/rnode_firmware_t3s3_sx127x.bin build/rnode_firmware_t3s3_sx127x.bootloader build/rnode_firmware_t3s3_sx127x.partitions
|
||||
rm -r build
|
||||
|
||||
|
||||
release-tbeam_supreme:
|
||||
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3D\""
|
||||
@@ -512,3 +503,4 @@ release-heltec_t114:
|
||||
arduino-cli compile --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3C\""
|
||||
cp build/Heltec_nRF52.Heltec_nRF52.HT-n5262/RNode_Firmware_CE.ino.hex build/rnode_firmware_heltec_t114.hex
|
||||
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_heltec_t114.hex Release/rnode_firmware_heltec_t114.zip
|
||||
rm -r build
|
||||
|
@@ -18,8 +18,8 @@
|
||||
#include "Utilities.h"
|
||||
|
||||
#if MCU_VARIANT == MCU_NRF52
|
||||
#define INTERFACE_SPI
|
||||
#if BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL
|
||||
#define INTERFACE_SPI
|
||||
// Required because on RAK4631, non-default SPI pins must be initialised when class is declared.
|
||||
SPIClass interface_spi[1] = {
|
||||
// SX1262
|
||||
@@ -31,6 +31,18 @@
|
||||
)
|
||||
};
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
#define INTERFACE_SPI
|
||||
SPIClass interface_spi[1] = {
|
||||
// SX1262
|
||||
SPIClass(
|
||||
NRF_SPIM3,
|
||||
interface_pins[0][3],
|
||||
interface_pins[0][1],
|
||||
interface_pins[0][2]
|
||||
)
|
||||
};
|
||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
#define INTERFACE_SPI
|
||||
SPIClass interface_spi[1] = {
|
||||
// SX1262
|
||||
SPIClass(
|
||||
@@ -66,6 +78,9 @@ volatile uint16_t queued_bytes[INTERFACE_COUNT] = {0};
|
||||
volatile uint16_t queue_cursor[INTERFACE_COUNT] = {0};
|
||||
volatile uint16_t current_packet_start[INTERFACE_COUNT] = {0};
|
||||
volatile bool serial_buffering = false;
|
||||
|
||||
extern void setup_interfaces(); // from /src/misc/ModemISR.h
|
||||
|
||||
#if HAS_BLUETOOTH || HAS_BLE == true
|
||||
bool bt_init_ran = false;
|
||||
#endif
|
||||
@@ -179,6 +194,8 @@ void setup() {
|
||||
memset(seq, 0xFF, sizeof(seq));
|
||||
memset(read_len, 0, sizeof(read_len));
|
||||
|
||||
setup_interfaces();
|
||||
|
||||
modem_packet_queue = xQueueCreate(MODEM_QUEUE_SIZE, sizeof(modem_packet_t*));
|
||||
|
||||
for (int i = 0; i < INTERFACE_COUNT; i++) {
|
||||
@@ -656,10 +673,10 @@ void flush_queue(RadioInterface* radio) {
|
||||
|
||||
}
|
||||
|
||||
queue_flushing = false;
|
||||
queue_height[index] = 0;
|
||||
queued_bytes[index] = 0;
|
||||
selected_radio->updateAirtime();
|
||||
queue_flushing = false;
|
||||
radio->updateAirtime();
|
||||
|
||||
#if HAS_DISPLAY
|
||||
display_tx[radio->getIndex()] = true;
|
||||
@@ -667,16 +684,12 @@ void flush_queue(RadioInterface* radio) {
|
||||
}
|
||||
|
||||
void pop_queue(RadioInterface* radio) {
|
||||
uint8_t index = radio->getIndex();
|
||||
uint8_t index = radio->getIndex();
|
||||
if (!queue_flushing) {
|
||||
queue_flushing = true;
|
||||
led_tx_on(); uint16_t processed = 0;
|
||||
|
||||
#if MCU_VARIANT == MCU_ESP32 || MCU_VARIANT == MCU_NRF52
|
||||
if (!fifo16_isempty(&packet_starts[index])) {
|
||||
#else
|
||||
if (!fifo16_isempty_locked(&packet_starts[index])) {
|
||||
#endif
|
||||
|
||||
uint16_t start = fifo16_pop(&packet_starts[index]);
|
||||
uint16_t length = fifo16_pop(&packet_lengths[index]);
|
||||
@@ -688,6 +701,7 @@ void pop_queue(RadioInterface* radio) {
|
||||
|
||||
transmit(radio, length); processed++;
|
||||
}
|
||||
|
||||
queue_height[index] -= processed;
|
||||
queued_bytes[index] -= length;
|
||||
}
|
||||
@@ -698,10 +712,11 @@ void pop_queue(RadioInterface* radio) {
|
||||
radio->updateAirtime();
|
||||
|
||||
queue_flushing = false;
|
||||
|
||||
|
||||
#if HAS_DISPLAY
|
||||
display_tx[radio->getIndex()] = true;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void transmit(RadioInterface* radio, uint16_t size) {
|
||||
@@ -725,8 +740,15 @@ void transmit(RadioInterface* radio, uint16_t size) {
|
||||
|
||||
// Only start a new packet if this is a split packet and it has
|
||||
// exceeded the length of a single packet
|
||||
if (written == 255 && header & 0x0F) {
|
||||
radio->endPacket(); radio->addAirtime();
|
||||
if (written == 255 && isSplitPacket(header)) {
|
||||
if (!radio->endPacket()) {
|
||||
kiss_indicate_error(ERROR_MODEM_TIMEOUT);
|
||||
kiss_indicate_error(ERROR_TXFAILED);
|
||||
led_indicate_error(5);
|
||||
hard_reset();
|
||||
}
|
||||
|
||||
radio->addAirtime();
|
||||
radio->beginPacket();
|
||||
radio->write(header);
|
||||
written = 1;
|
||||
@@ -872,6 +894,7 @@ void serial_callback(uint8_t sbyte) {
|
||||
}
|
||||
if (frame_len < CMD_L) cmdbuf[frame_len++] = sbyte;
|
||||
}
|
||||
|
||||
|
||||
if (frame_len == 4) {
|
||||
selected_radio = interface_obj[interface];
|
||||
|
39
Radio.cpp
39
Radio.cpp
@@ -5,6 +5,7 @@
|
||||
// Obviously still under the MIT license.
|
||||
|
||||
#include "Radio.hpp"
|
||||
#include "src/misc/ModemISR.h"
|
||||
|
||||
#if PLATFORM == PLATFORM_ESP32
|
||||
#if defined(ESP32) and !defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
@@ -91,31 +92,6 @@
|
||||
extern FIFOBuffer packet_rdy_interfaces;
|
||||
extern RadioInterface* interface_obj[];
|
||||
|
||||
// ISRs cannot provide parameters to the functions they call. Since we have
|
||||
// multiple interfaces, we have to read each dio0 pin for each one and see
|
||||
// which one is high. We can then use the index of this pin in the 2D array to
|
||||
// signal the correct interface to the main loop
|
||||
void ISR_VECT onDio0Rise() {
|
||||
BaseType_t int_status = taskENTER_CRITICAL_FROM_ISR();
|
||||
for (int i = 0; i < INTERFACE_COUNT; i++) {
|
||||
if (digitalRead(interface_pins[i][5]) == HIGH) {
|
||||
if (interface_obj[i]->getPacketValidity()) {
|
||||
interface_obj[i]->handleDio0Rise();
|
||||
}
|
||||
if (interfaces[i] == SX1280) {
|
||||
// On the SX1280, there is a bug which can cause the busy line
|
||||
// to remain high if a high amount of packets are received when
|
||||
// in continuous RX mode. This is documented as Errata 16.1 in
|
||||
// the SX1280 datasheet v3.2 (page 149)
|
||||
// Therefore, the modem is set into receive mode each time a packet is received.
|
||||
interface_obj[i]->receive();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL_FROM_ISR(int_status);
|
||||
}
|
||||
|
||||
sx126x::sx126x(uint8_t index, SPIClass* spi, bool tcxo, bool dio2_as_rf_switch, int ss, int sclk, int mosi, int miso, int reset, int dio0, int busy, int rxen) :
|
||||
RadioInterface(index),
|
||||
_spiSettings(8E6, MSBFIRST, SPI_MODE0), _spiModem(spi), _ss(ss),
|
||||
@@ -669,9 +645,9 @@ void sx126x::onReceive(void(*callback)(uint8_t, int))
|
||||
_spiModem->usingInterrupt(digitalPinToInterrupt(_dio0));
|
||||
#endif
|
||||
// make function available
|
||||
extern void onDio0Rise();
|
||||
extern void (*onIntRise[INTERFACE_COUNT])(void);
|
||||
|
||||
attachInterrupt(digitalPinToInterrupt(_dio0), onDio0Rise, RISING);
|
||||
attachInterrupt(digitalPinToInterrupt(_dio0), onIntRise[_index], RISING);
|
||||
} else {
|
||||
detachInterrupt(digitalPinToInterrupt(_dio0));
|
||||
#ifdef SPI_HAS_NOTUSINGINTERRUPT
|
||||
@@ -1321,10 +1297,9 @@ void sx127x::onReceive(void(*callback)(uint8_t, int)) {
|
||||
#endif
|
||||
|
||||
// make function available
|
||||
extern void onDio0Rise();
|
||||
extern void (*onIntRise[INTERFACE_COUNT])(void);
|
||||
|
||||
attachInterrupt(digitalPinToInterrupt(_dio0), onDio0Rise, RISING);
|
||||
|
||||
attachInterrupt(digitalPinToInterrupt(_dio0), onIntRise[_index], RISING);
|
||||
} else {
|
||||
detachInterrupt(digitalPinToInterrupt(_dio0));
|
||||
|
||||
@@ -2106,9 +2081,9 @@ void sx128x::onReceive(void(*callback)(uint8_t, int))
|
||||
#endif
|
||||
|
||||
// make function available
|
||||
extern void onDio0Rise();
|
||||
extern void (*onIntRise[INTERFACE_COUNT])(void);
|
||||
|
||||
attachInterrupt(digitalPinToInterrupt(_dio0), onDio0Rise, RISING);
|
||||
attachInterrupt(digitalPinToInterrupt(_dio0), onIntRise[_index], RISING);
|
||||
} else {
|
||||
detachInterrupt(digitalPinToInterrupt(_dio0));
|
||||
#ifdef SPI_HAS_NOTUSINGINTERRUPT
|
||||
|
45
src/misc/ModemISR.h
Normal file
45
src/misc/ModemISR.h
Normal file
@@ -0,0 +1,45 @@
|
||||
extern RadioInterface* interface_obj[INTERFACE_COUNT];
|
||||
void (*onIntRise[INTERFACE_COUNT]) (void);
|
||||
|
||||
#if INTERFACE_COUNT == 1
|
||||
void onInt0Rise() {
|
||||
if (interfaces[0] == SX1280) {
|
||||
// On the SX1280, there is a bug which can cause the busy line
|
||||
// to remain high if a high amount of packets are received when
|
||||
// in continuous RX mode. This is documented as Errata 16.1 in
|
||||
// the SX1280 datasheet v3.2 (page 149)
|
||||
// Therefore, the modem is set into receive mode each time a packet is received.
|
||||
interface_obj[0]->receive();
|
||||
}
|
||||
if (interface_obj[0]->getPacketValidity()) {
|
||||
interface_obj[0]->handleDio0Rise();
|
||||
}
|
||||
}
|
||||
|
||||
void setup_interfaces() {
|
||||
onIntRise[0] = onInt0Rise;
|
||||
}
|
||||
#elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL
|
||||
void onInt0Rise() {
|
||||
if (interface_obj[0]->getPacketValidity()) {
|
||||
interface_obj[0]->handleDio0Rise();
|
||||
}
|
||||
}
|
||||
|
||||
void onInt1Rise() {
|
||||
// On the SX1280, there is a bug which can cause the busy line
|
||||
// to remain high if a high amount of packets are received when
|
||||
// in continuous RX mode. This is documented as Errata 16.1 in
|
||||
// the SX1280 datasheet v3.2 (page 149)
|
||||
// Therefore, the modem is set into receive mode each time a packet is received.
|
||||
interface_obj[1]->receive();
|
||||
if (interface_obj[1]->getPacketValidity()) {
|
||||
interface_obj[1]->handleDio0Rise();
|
||||
}
|
||||
}
|
||||
|
||||
void setup_interfaces() {
|
||||
onIntRise[0] = onInt0Rise;
|
||||
onIntRise[1] = onInt1Rise;
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user