]> git.tnoah.ca Git - lora-radio.git/commitdiff
Improved multiplatform support
authorMark Qvist <mark@unsigned.io>
Fri, 14 Jan 2022 19:49:50 +0000 (20:49 +0100)
committerMark Qvist <mark@unsigned.io>
Fri, 14 Jan 2022 19:49:50 +0000 (20:49 +0100)
Config.h

index b03d67269ffe602e101f32779543dde6207d16e2..c09d961c01b2bb2beff7bc412cc8f7b1e2296936 100644 (file)
--- a/Config.h
+++ b/Config.h
        #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
 
                #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
        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];