2024-02-09 15:29:54 +01:00
|
|
|
// Copyright (C) 2024, Mark Qvist
|
|
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
2024-02-11 18:27:47 +01:00
|
|
|
#include "Modem.h"
|
2024-02-09 15:29:54 +01:00
|
|
|
|
|
|
|
|
#ifndef BOARDS_H
|
|
|
|
|
#define BOARDS_H
|
2024-02-11 18:27:47 +01:00
|
|
|
|
|
|
|
|
#define PLATFORM_AVR 0x90
|
|
|
|
|
#define PLATFORM_ESP32 0x80
|
|
|
|
|
#define PLATFORM_NRF52 0x70
|
|
|
|
|
|
|
|
|
|
#define MCU_1284P 0x91
|
|
|
|
|
#define MCU_2560 0x92
|
|
|
|
|
#define MCU_ESP32 0x81
|
|
|
|
|
#define MCU_NRF52 0x71
|
|
|
|
|
|
|
|
|
|
#define BOARD_RNODE 0x31
|
|
|
|
|
#define BOARD_HMBRW 0x32
|
|
|
|
|
#define BOARD_TBEAM 0x33
|
|
|
|
|
#define BOARD_HUZZAH32 0x34
|
|
|
|
|
#define BOARD_GENERIC_ESP32 0x35
|
|
|
|
|
#define BOARD_LORA32_V2_0 0x36
|
|
|
|
|
#define BOARD_LORA32_V2_1 0x37
|
|
|
|
|
#define BOARD_LORA32_V1_0 0x39
|
|
|
|
|
#define BOARD_HELTEC32_V2 0x38
|
2024-04-11 01:38:06 -04:00
|
|
|
#define BOARD_HELTEC32_V3 0x3A
|
2024-02-11 18:27:47 +01:00
|
|
|
#define BOARD_RNODE_NG_20 0x40
|
|
|
|
|
#define BOARD_RNODE_NG_21 0x41
|
|
|
|
|
#define BOARD_RNODE_NG_22 0x42
|
|
|
|
|
#define BOARD_GENERIC_NRF52 0x50
|
|
|
|
|
#define BOARD_RAK4630 0x51
|
|
|
|
|
|
|
|
|
|
#if defined(__AVR_ATmega1284P__)
|
|
|
|
|
#define PLATFORM PLATFORM_AVR
|
|
|
|
|
#define MCU_VARIANT MCU_1284P
|
|
|
|
|
#elif defined(__AVR_ATmega2560__)
|
|
|
|
|
#define PLATFORM PLATFORM_AVR
|
|
|
|
|
#define MCU_VARIANT MCU_2560
|
|
|
|
|
#elif defined(ESP32)
|
|
|
|
|
#define PLATFORM PLATFORM_ESP32
|
|
|
|
|
#define MCU_VARIANT MCU_ESP32
|
|
|
|
|
#elif defined(NRF52840_XXAA)
|
2024-02-14 15:19:04 +01:00
|
|
|
#include <variant.h>
|
2024-02-11 18:27:47 +01:00
|
|
|
#define PLATFORM PLATFORM_NRF52
|
|
|
|
|
#define MCU_VARIANT MCU_NRF52
|
|
|
|
|
#else
|
|
|
|
|
#error "The firmware cannot be compiled for the selected MCU variant"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef MODEM
|
|
|
|
|
#if BOARD_MODEL == BOARD_RAK4630
|
|
|
|
|
#define MODEM SX1262
|
|
|
|
|
#elif BOARD_MODEL == BOARD_GENERIC_NRF52
|
|
|
|
|
#define MODEM SX1262
|
|
|
|
|
#else
|
|
|
|
|
#define MODEM SX1276
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define HAS_DISPLAY false
|
|
|
|
|
#define HAS_BLUETOOTH false
|
2024-03-11 03:59:42 -04:00
|
|
|
#define HAS_BLE false
|
2024-02-11 18:27:47 +01:00
|
|
|
#define HAS_TCXO false
|
|
|
|
|
#define HAS_PMU false
|
|
|
|
|
#define HAS_NP false
|
|
|
|
|
#define HAS_EEPROM false
|
|
|
|
|
|
|
|
|
|
#if defined(ENABLE_TCXO)
|
|
|
|
|
#define HAS_TCXO true
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if MCU_VARIANT == MCU_1284P
|
|
|
|
|
const int pin_cs = 4;
|
|
|
|
|
const int pin_reset = 3;
|
|
|
|
|
const int pin_dio = 2;
|
|
|
|
|
const int pin_led_rx = 12;
|
|
|
|
|
const int pin_led_tx = 13;
|
|
|
|
|
|
|
|
|
|
#define BOARD_MODEL BOARD_RNODE
|
|
|
|
|
#define HAS_EEPROM true
|
|
|
|
|
#define CONFIG_UART_BUFFER_SIZE 6144
|
|
|
|
|
#define CONFIG_QUEUE_SIZE 6144
|
|
|
|
|
#define CONFIG_QUEUE_MAX_LENGTH 200
|
|
|
|
|
#define EEPROM_SIZE 4096
|
|
|
|
|
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
2024-02-09 15:29:54 +01:00
|
|
|
|
2024-02-11 18:27:47 +01:00
|
|
|
#elif MCU_VARIANT == MCU_2560
|
|
|
|
|
const int pin_cs = 5;
|
|
|
|
|
const int pin_reset = 4;
|
|
|
|
|
const int pin_dio = 2;
|
|
|
|
|
const int pin_led_rx = 12;
|
|
|
|
|
const int pin_led_tx = 13;
|
|
|
|
|
|
|
|
|
|
#define BOARD_MODEL BOARD_HMBRW
|
|
|
|
|
#define HAS_EEPROM true
|
|
|
|
|
#define CONFIG_UART_BUFFER_SIZE 768
|
|
|
|
|
#define CONFIG_QUEUE_SIZE 5120
|
|
|
|
|
#define CONFIG_QUEUE_MAX_LENGTH 24
|
|
|
|
|
#define EEPROM_SIZE 4096
|
|
|
|
|
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
|
|
|
|
|
|
|
|
|
#elif 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.
|
|
|
|
|
//
|
|
|
|
|
// #define BOARD_MODEL BOARD_GENERIC_ESP32
|
|
|
|
|
#define CONFIG_UART_BUFFER_SIZE 6144
|
|
|
|
|
#define CONFIG_QUEUE_SIZE 6144
|
|
|
|
|
#define CONFIG_QUEUE_MAX_LENGTH 200
|
|
|
|
|
|
|
|
|
|
#define EEPROM_SIZE 1024
|
|
|
|
|
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
|
|
|
|
|
|
|
|
|
#define GPS_BAUD_RATE 9600
|
|
|
|
|
#define PIN_GPS_TX 12
|
|
|
|
|
#define PIN_GPS_RX 34
|
|
|
|
|
|
|
|
|
|
#if BOARD_MODEL == BOARD_GENERIC_ESP32
|
|
|
|
|
#define HAS_BLUETOOTH true
|
|
|
|
|
#define HAS_CONSOLE true
|
|
|
|
|
#define HAS_EEPROM true
|
|
|
|
|
const int pin_cs = 4;
|
|
|
|
|
const int pin_reset = 36;
|
|
|
|
|
const int pin_dio = 39;
|
|
|
|
|
const int pin_led_rx = 14;
|
|
|
|
|
const int pin_led_tx = 32;
|
|
|
|
|
|
|
|
|
|
#elif BOARD_MODEL == BOARD_TBEAM
|
|
|
|
|
#define HAS_DISPLAY true
|
|
|
|
|
#define HAS_PMU true
|
|
|
|
|
#define HAS_BLUETOOTH true
|
2024-03-11 03:59:42 -04:00
|
|
|
#define HAS_BLE true
|
2024-02-11 18:27:47 +01:00
|
|
|
#define HAS_CONSOLE true
|
|
|
|
|
#define HAS_SD false
|
|
|
|
|
#define HAS_EEPROM true
|
|
|
|
|
#define I2C_SDA 21
|
|
|
|
|
#define I2C_SCL 22
|
|
|
|
|
#define PMU_IRQ 35
|
|
|
|
|
const int pin_cs = 18;
|
|
|
|
|
const int pin_reset = 23;
|
|
|
|
|
const int pin_led_rx = 2;
|
|
|
|
|
const int pin_led_tx = 4;
|
|
|
|
|
|
|
|
|
|
#if MODEM == SX1262
|
|
|
|
|
#define HAS_TCXO true
|
|
|
|
|
#define HAS_BUSY true
|
|
|
|
|
#define DIO2_AS_RF_SWITCH true
|
|
|
|
|
const int pin_busy = 32;
|
|
|
|
|
const int pin_dio = 33;
|
|
|
|
|
const int pin_tcxo_enable = -1;
|
2024-02-10 13:49:41 +01:00
|
|
|
#else
|
2024-02-11 18:27:47 +01:00
|
|
|
const int pin_dio = 26;
|
2024-02-10 13:49:41 +01:00
|
|
|
#endif
|
2024-02-11 18:27:47 +01:00
|
|
|
|
|
|
|
|
#elif BOARD_MODEL == BOARD_HUZZAH32
|
|
|
|
|
#define HAS_BLUETOOTH true
|
|
|
|
|
#define HAS_CONSOLE true
|
|
|
|
|
#define HAS_EEPROM true
|
|
|
|
|
const int pin_cs = 4;
|
|
|
|
|
const int pin_reset = 36;
|
|
|
|
|
const int pin_dio = 39;
|
|
|
|
|
const int pin_led_rx = 14;
|
|
|
|
|
const int pin_led_tx = 32;
|
|
|
|
|
|
|
|
|
|
#elif BOARD_MODEL == BOARD_LORA32_V1_0
|
|
|
|
|
#define HAS_DISPLAY true
|
|
|
|
|
#define HAS_BLUETOOTH true
|
2024-03-11 03:59:42 -04:00
|
|
|
#define HAS_BLE true
|
2024-02-11 18:27:47 +01:00
|
|
|
#define HAS_CONSOLE true
|
|
|
|
|
#define HAS_EEPROM true
|
|
|
|
|
const int pin_cs = 18;
|
|
|
|
|
const int pin_reset = 14;
|
|
|
|
|
const int pin_dio = 26;
|
|
|
|
|
#if defined(EXTERNAL_LEDS)
|
|
|
|
|
const int pin_led_rx = 25;
|
|
|
|
|
const int pin_led_tx = 2;
|
|
|
|
|
#else
|
|
|