- nRF52840 board with nice!nano UF2 bootloader - Ebyte E22-400M33S LoRa module (SX1268 + PA, 33dBm/2W) - LoRa: 480.375MHz, BW=125, SF=11, CR=5 - Pins: SPI(P1.0/P0.22/P0.20), CS(P0.17), DIO1(P1.10), RESET(P1.13), BUSY(P0.28), RXEN(P1.09), LED(P0.15), Button(P0.24), Buzzer(P1.11), VBAT_ADC(P0.03), CHAG_DET(P0.13), I2C(P0.08/P0.04) - 6 build environments: repeater, room_server, companion_radio_usb/ble, terminal_chat, kiss_modem - Custom nicenano board definition with s140 v6 softdevice
40 lines
970 B
C++
40 lines
970 B
C++
#include <Arduino.h>
|
|
#include "target.h"
|
|
#include <helpers/ArduinoHelpers.h>
|
|
|
|
MoonshineNRF52EbyteBoard board;
|
|
|
|
#ifndef PIN_USER_BTN
|
|
#define PIN_USER_BTN (-1)
|
|
#endif
|
|
|
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
|
|
|
WRAPPER_CLASS radio_driver(radio, board);
|
|
|
|
VolatileRTCClock fallback_clock;
|
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|
|
|
#if ENV_INCLUDE_GPS
|
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
|
#else
|
|
EnvironmentSensorManager sensors;
|
|
#endif
|
|
|
|
#ifdef DISPLAY_CLASS
|
|
DISPLAY_CLASS display;
|
|
MomentaryButton user_btn(PIN_USER_BTN, 1000, true, true);
|
|
#endif
|
|
|
|
bool radio_init() {
|
|
rtc_clock.begin(Wire);
|
|
return radio.std_init(&SPI);
|
|
}
|
|
|
|
mesh::LocalIdentity radio_new_identity() {
|
|
RadioNoiseListener rng(radio);
|
|
return mesh::LocalIdentity(&rng);
|
|
}
|