From af01541c17fce0eb3e352e963d78dfb7dfa9165e Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 14 Jan 2022 20:49:50 +0100 Subject: [PATCH] Improved multiplatform support --- Config.h | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/Config.h b/Config.h index b03d672..c09d961 100644 --- a/Config.h +++ b/Config.h @@ -13,20 +13,24 @@ #define MCU_2560 0x92 #define MCU_ESP32 0x81 + #define BOARD_RNODE 0x31 + #define BOARD_HMBRW 0x32 + #define BOARD_TBEAM 0x33 + #define MODE_HOST 0x11 #define MODE_TNC 0x12 #if defined(__AVR_ATmega1284P__) - #define PLATFORM PLATFORM_AVR - #define MCU_VARIANT MCU_1284P + #define PLATFORM PLATFORM_AVR + #define MCU_VARIANT MCU_1284P #elif defined(__AVR_ATmega2560__) - #define PLATFORM PLATFORM_AVR - #define MCU_VARIANT MCU_2560 + #define PLATFORM PLATFORM_AVR + #define MCU_VARIANT MCU_2560 #elif defined(ESP32) - #define PLATFORM PLATFORM_ESP32 - #define MCU_VARIANT MCU_ESP32 + #define PLATFORM PLATFORM_ESP32 + #define MCU_VARIANT MCU_ESP32 #else - #error "The firmware cannot be compiled for the selected MCU variant" + #error "The firmware cannot be compiled for the selected MCU variant" #endif #define MTU 500 @@ -45,6 +49,8 @@ const int pin_led_rx = 12; const int pin_led_tx = 13; + #define BOARD_MODEL BOARD_RNODE + #define CONFIG_UART_BUFFER_SIZE 6144 #define CONFIG_QUEUE_SIZE 6144 #define CONFIG_QUEUE_MAX_LENGTH 250 @@ -59,6 +65,8 @@ const int pin_led_rx = 12; const int pin_led_tx = 13; + #define BOARD_MODEL BOARD_HMBRW + #define CONFIG_UART_BUFFER_SIZE 2048 #define CONFIG_QUEUE_SIZE 2048 #define CONFIG_QUEUE_MAX_LENGTH 80 @@ -73,7 +81,9 @@ const int pin_led_rx = 2; const int pin_led_tx = 4; - #define CONFIG_UART_BUFFER_SIZE 6144 + #define BOARD_MODEL BOARD_TBEAM + + #define CONFIG_UART_BUFFER_SIZE 64 #define CONFIG_QUEUE_SIZE 6144 #define CONFIG_QUEUE_MAX_LENGTH 250 @@ -85,6 +95,12 @@ #define PIN_GPS_RX 34 #endif + #if BOARD_MODEL == BOARD_TBEAM + #define I2C_SDA 21 + #define I2C_SCL 22 + #define PMU_IRQ 35 + #endif + #define eeprom_addr(a) (a+EEPROM_OFFSET) // MCU independent configuration parameters @@ -117,8 +133,8 @@ int last_rssi = -292; uint8_t last_rssi_raw = 0x00; uint8_t last_snr_raw = 0x00; - size_t read_len = 0; uint8_t seq = 0xFF; + uint16_t read_len = 0; // Incoming packet buffer uint8_t pbuf[MTU];