mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2024-10-01 03:15:39 -04:00
Added board configuration
This commit is contained in:
parent
98ee2f6d32
commit
28be170cef
33
Config.h
33
Config.h
@ -42,6 +42,7 @@
|
||||
#define BOARD_HELTEC32_V2 0x38
|
||||
#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
|
||||
|
||||
@ -299,6 +300,36 @@
|
||||
const int pin_led_tx = 25;
|
||||
#endif
|
||||
#endif
|
||||
#elif BOARD_MODEL == BOARD_RNODE_NG_22
|
||||
#define HAS_DISPLAY true
|
||||
#define HAS_BLUETOOTH false // TODO: Implement
|
||||
#define HAS_CONSOLE false // TODO: Implement
|
||||
#define HAS_PMU true
|
||||
#define HAS_NP true
|
||||
#define HAS_SD false
|
||||
#define HAS_EEPROM true
|
||||
#define MODEM_MISO 3
|
||||
#define MODEM_MOSI 6
|
||||
#define MODEM_CLK 5
|
||||
const int pin_cs = 7;
|
||||
const int pin_reset = 8;
|
||||
const int pin_dio = 33;
|
||||
const int pin_np = 38;
|
||||
const int pin_dac = 25;
|
||||
const int pin_adc = 1;
|
||||
const int SD_MISO = 2;
|
||||
const int SD_MOSI = 11;
|
||||
const int SD_CLK = 14;
|
||||
const int SD_CS = 13;
|
||||
#if HAS_NP == false
|
||||
#if defined(EXTERNAL_LEDS)
|
||||
const int pin_led_rx = 37;
|
||||
const int pin_led_tx = 37;
|
||||
#else
|
||||
const int pin_led_rx = 37;
|
||||
const int pin_led_tx = 37;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#elif PLATFORM == PLATFORM_NRF52
|
||||
#if BOARD_MODEL == BOARD_RAK4630
|
||||
@ -351,7 +382,7 @@
|
||||
const int pin_busy = -1;
|
||||
#endif
|
||||
|
||||
#if MODEM == SX1262
|
||||
#if MODEM == SX1262 && defined(NRF52840_XXAA)
|
||||
SPIClass spiModem(NRF_SPIM2, pin_miso, pin_sclk, pin_mosi);
|
||||
#endif
|
||||
|
||||
|
7
Device.h
7
Device.h
@ -151,7 +151,12 @@ bool device_init() {
|
||||
mbedtls_md_init(&ctx);
|
||||
mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type), 0);
|
||||
mbedtls_md_starts(&ctx);
|
||||
mbedtls_md_update(&ctx, dev_bt_mac, BT_DEV_ADDR_LEN);
|
||||
#if HAS_BLUETOOTH == true
|
||||
mbedtls_md_update(&ctx, dev_bt_mac, BT_DEV_ADDR_LEN);
|
||||
#else
|
||||
// TODO: Get from BLE stack instead
|
||||
// mbedtls_md_update(&ctx, dev_bt_mac, BT_DEV_ADDR_LEN);
|
||||
#endif
|
||||
mbedtls_md_update(&ctx, dev_eeprom_signature, EEPROM_SIG_LEN);
|
||||
mbedtls_md_finish(&ctx, dev_hash);
|
||||
mbedtls_md_free(&ctx);
|
||||
|
@ -35,6 +35,11 @@
|
||||
#elif BOARD_MODEL == BOARD_RNODE_NG_21
|
||||
#define DISP_RST -1
|
||||
#define DISP_ADDR 0x3C
|
||||
#elif BOARD_MODEL == BOARD_RNODE_NG_22
|
||||
#define DISP_RST 21
|
||||
#define DISP_ADDR 0x3C
|
||||
#define SCL_OLED 17
|
||||
#define SDA_OLED 18
|
||||
#else
|
||||
#define DISP_RST -1
|
||||
#define DISP_ADDR 0x3C
|
||||
@ -99,6 +104,8 @@ bool display_init() {
|
||||
digitalWrite(pin_display_en, LOW);
|
||||
delay(50);
|
||||
digitalWrite(pin_display_en, HIGH);
|
||||
#elif BOARD_MODEL == BOARD_RNODE_NG_22
|
||||
Wire.begin(SDA_OLED, SCL_OLED);
|
||||
#elif BOARD_MODEL == BOARD_HELTEC32_V2
|
||||
Wire.begin(SDA_OLED, SCL_OLED);
|
||||
#elif BOARD_MODEL == BOARD_LORA32_V1_0
|
||||
|
19
LoRa.cpp
19
LoRa.cpp
@ -30,7 +30,9 @@
|
||||
#endif
|
||||
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
#include "soc/rtc_wdt.h"
|
||||
#if BOARD_MODEL != BOARD_RNODE_NG_22
|
||||
#include "soc/rtc_wdt.h"
|
||||
#endif
|
||||
#define ISR_VECT IRAM_ATTR
|
||||
#else
|
||||
#define ISR_VECT
|
||||
@ -89,9 +91,11 @@
|
||||
int fifo_tx_addr_ptr = 0;
|
||||
int fifo_rx_addr_ptr = 0;
|
||||
uint8_t packet[256] = {0};
|
||||
extern SPIClass spiModem;
|
||||
#define SPI spiModem
|
||||
|
||||
#if defined(NRF52840_XXAA)
|
||||
extern SPIClass spiModem;
|
||||
#define SPI spiModem
|
||||
#endif
|
||||
|
||||
#elif MODEM == SX1276 || MODEM == SX1278
|
||||
// Registers
|
||||
@ -182,7 +186,11 @@ bool LoRaClass::preInit() {
|
||||
// set SS high
|
||||
digitalWrite(_ss, HIGH);
|
||||
|
||||
SPI.begin();
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_22
|
||||
SPI.begin(MODEM_CLK, MODEM_MISO, MODEM_MOSI);
|
||||
#else
|
||||
SPI.begin();
|
||||
#endif
|
||||
|
||||
// check version (retry for up to 2 seconds)
|
||||
#if MODEM == SX1276 || MODEM == SX1278
|
||||
@ -201,6 +209,7 @@ bool LoRaClass::preInit() {
|
||||
|
||||
lora_preinit_done = true;
|
||||
return true;
|
||||
|
||||
#elif MODEM == SX1262
|
||||
long start = millis();
|
||||
uint8_t syncmsb;
|
||||
@ -213,12 +222,14 @@ bool LoRaClass::preInit() {
|
||||
}
|
||||
delay(100);
|
||||
}
|
||||
|
||||
if ( uint16_t(syncmsb << 8 | synclsb) != 0x1424 && uint16_t(syncmsb << 8 | synclsb) != 0x4434) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lora_preinit_done = true;
|
||||
return true;
|
||||
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
Binary file not shown.
@ -44,7 +44,9 @@
|
||||
#include "Device.h"
|
||||
#endif
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
#include "soc/rtc_wdt.h"
|
||||
#if BOARD_MODEL != BOARD_RNODE_NG_22
|
||||
#include "soc/rtc_wdt.h"
|
||||
#endif
|
||||
#define ISR_VECT IRAM_ATTR
|
||||
#else
|
||||
#define ISR_VECT
|
||||
|
Loading…
Reference in New Issue
Block a user