mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Adds a new variant 'ikoka_stick_nrf' and associated support files. This is based on the Xiao nRF54 code with pin numbers and functions changed to suit the differences in hardware between the WIO SX1262 board and the Ikoka Stick. Sets the default LoRa transmit power to 9dBm to avoid burning up the frontend in Ikoka Sticks equipped with the Ebyte 33dBm S22 module on first boot. Adds support for an SSD1306 display connected to the display header. Note the display pinout is the same as the RAK4631 display header so make sure to use a display wired accordingly (aliexpress etc. SSD1306s typically have Vcc & GND reversed from what this board expects). Adds support for display rotation to SSD1306Display via a platformIO define. This support was added following the same paradigms found elsewhere in the code for rotating a display.
43 lines
970 B
C++
43 lines
970 B
C++
#include <Arduino.h>
|
|
#include "target.h"
|
|
#include <helpers/ArduinoHelpers.h>
|
|
|
|
ikoka_stick_nrf_board board;
|
|
|
|
#ifdef DISPLAY_CLASS
|
|
DISPLAY_CLASS display;
|
|
#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);
|
|
EnvironmentSensorManager sensors;
|
|
|
|
bool radio_init() {
|
|
rtc_clock.begin(Wire);
|
|
|
|
return radio.std_init(&SPI);
|
|
}
|
|
|
|
uint32_t radio_get_rng_seed() {
|
|
return radio.random(0x7FFFFFFF);
|
|
}
|
|
|
|
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) {
|
|
radio.setFrequency(freq);
|
|
radio.setSpreadingFactor(sf);
|
|
radio.setBandwidth(bw);
|
|
radio.setCodingRate(cr);
|
|
}
|
|
|
|
void radio_set_tx_power(uint8_t dbm) {
|
|
radio.setOutputPower(dbm);
|
|
}
|
|
|
|
mesh::LocalIdentity radio_new_identity() {
|
|
RadioNoiseListener rng(radio);
|
|
return mesh::LocalIdentity(&rng); // create new random identity
|
|
}
|