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_HELTEC32_V2 0x38
|
||||||
#define BOARD_RNODE_NG_20 0x40
|
#define BOARD_RNODE_NG_20 0x40
|
||||||
#define BOARD_RNODE_NG_21 0x41
|
#define BOARD_RNODE_NG_21 0x41
|
||||||
|
#define BOARD_RNODE_NG_22 0x42
|
||||||
#define BOARD_GENERIC_NRF52 0x50
|
#define BOARD_GENERIC_NRF52 0x50
|
||||||
#define BOARD_RAK4630 0x51
|
#define BOARD_RAK4630 0x51
|
||||||
|
|
||||||
@ -299,6 +300,36 @@
|
|||||||
const int pin_led_tx = 25;
|
const int pin_led_tx = 25;
|
||||||
#endif
|
#endif
|
||||||
#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
|
#endif
|
||||||
#elif PLATFORM == PLATFORM_NRF52
|
#elif PLATFORM == PLATFORM_NRF52
|
||||||
#if BOARD_MODEL == BOARD_RAK4630
|
#if BOARD_MODEL == BOARD_RAK4630
|
||||||
@ -351,7 +382,7 @@
|
|||||||
const int pin_busy = -1;
|
const int pin_busy = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MODEM == SX1262
|
#if MODEM == SX1262 && defined(NRF52840_XXAA)
|
||||||
SPIClass spiModem(NRF_SPIM2, pin_miso, pin_sclk, pin_mosi);
|
SPIClass spiModem(NRF_SPIM2, pin_miso, pin_sclk, pin_mosi);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
7
Device.h
7
Device.h
@ -151,7 +151,12 @@ bool device_init() {
|
|||||||
mbedtls_md_init(&ctx);
|
mbedtls_md_init(&ctx);
|
||||||
mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type), 0);
|
mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type), 0);
|
||||||
mbedtls_md_starts(&ctx);
|
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_update(&ctx, dev_eeprom_signature, EEPROM_SIG_LEN);
|
||||||
mbedtls_md_finish(&ctx, dev_hash);
|
mbedtls_md_finish(&ctx, dev_hash);
|
||||||
mbedtls_md_free(&ctx);
|
mbedtls_md_free(&ctx);
|
||||||
|
@ -35,6 +35,11 @@
|
|||||||
#elif BOARD_MODEL == BOARD_RNODE_NG_21
|
#elif BOARD_MODEL == BOARD_RNODE_NG_21
|
||||||
#define DISP_RST -1
|
#define DISP_RST -1
|
||||||
#define DISP_ADDR 0x3C
|
#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
|
#else
|
||||||
#define DISP_RST -1
|
#define DISP_RST -1
|
||||||
#define DISP_ADDR 0x3C
|
#define DISP_ADDR 0x3C
|
||||||
@ -99,6 +104,8 @@ bool display_init() {
|
|||||||
digitalWrite(pin_display_en, LOW);
|
digitalWrite(pin_display_en, LOW);
|
||||||
delay(50);
|
delay(50);
|
||||||
digitalWrite(pin_display_en, HIGH);
|
digitalWrite(pin_display_en, HIGH);
|
||||||
|
#elif BOARD_MODEL == BOARD_RNODE_NG_22
|
||||||
|
Wire.begin(SDA_OLED, SCL_OLED);
|
||||||
#elif BOARD_MODEL == BOARD_HELTEC32_V2
|
#elif BOARD_MODEL == BOARD_HELTEC32_V2
|
||||||
Wire.begin(SDA_OLED, SCL_OLED);
|
Wire.begin(SDA_OLED, SCL_OLED);
|
||||||
#elif BOARD_MODEL == BOARD_LORA32_V1_0
|
#elif BOARD_MODEL == BOARD_LORA32_V1_0
|
||||||
|
19
LoRa.cpp
19
LoRa.cpp
@ -30,7 +30,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MCU_VARIANT == MCU_ESP32
|
#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
|
#define ISR_VECT IRAM_ATTR
|
||||||
#else
|
#else
|
||||||
#define ISR_VECT
|
#define ISR_VECT
|
||||||
@ -89,9 +91,11 @@
|
|||||||
int fifo_tx_addr_ptr = 0;
|
int fifo_tx_addr_ptr = 0;
|
||||||
int fifo_rx_addr_ptr = 0;
|
int fifo_rx_addr_ptr = 0;
|
||||||
uint8_t packet[256] = {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
|
#elif MODEM == SX1276 || MODEM == SX1278
|
||||||
// Registers
|
// Registers
|
||||||
@ -182,7 +186,11 @@ bool LoRaClass::preInit() {
|
|||||||
// set SS high
|
// set SS high
|
||||||
digitalWrite(_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)
|
// check version (retry for up to 2 seconds)
|
||||||
#if MODEM == SX1276 || MODEM == SX1278
|
#if MODEM == SX1276 || MODEM == SX1278
|
||||||
@ -201,6 +209,7 @@ bool LoRaClass::preInit() {
|
|||||||
|
|
||||||
lora_preinit_done = true;
|
lora_preinit_done = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#elif MODEM == SX1262
|
#elif MODEM == SX1262
|
||||||
long start = millis();
|
long start = millis();
|
||||||
uint8_t syncmsb;
|
uint8_t syncmsb;
|
||||||
@ -213,12 +222,14 @@ bool LoRaClass::preInit() {
|
|||||||
}
|
}
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( uint16_t(syncmsb << 8 | synclsb) != 0x1424 && uint16_t(syncmsb << 8 | synclsb) != 0x4434) {
|
if ( uint16_t(syncmsb << 8 | synclsb) != 0x1424 && uint16_t(syncmsb << 8 | synclsb) != 0x4434) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lora_preinit_done = true;
|
lora_preinit_done = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
Binary file not shown.
@ -44,7 +44,9 @@
|
|||||||
#include "Device.h"
|
#include "Device.h"
|
||||||
#endif
|
#endif
|
||||||
#if MCU_VARIANT == MCU_ESP32
|
#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
|
#define ISR_VECT IRAM_ATTR
|
||||||
#else
|
#else
|
||||||
#define ISR_VECT
|
#define ISR_VECT
|
||||||
|
Loading…
Reference in New Issue
Block a user