Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
#ifdef XIAO_NRF52

#include <Arduino.h>
#include "ikoka_stick_nrf_board.h"
#include "IkokaStickNRFBoard.h"

#include <bluefruit.h>
#include <Wire.h>

static BLEDfu bledfu;

static void connect_callback(uint16_t conn_handle)
{
static void connect_callback(uint16_t conn_handle) {
(void)conn_handle;
MESH_DEBUG_PRINTLN("BLE client connected");
}

static void disconnect_callback(uint16_t conn_handle, uint8_t reason)
{
static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
(void)conn_handle;
(void)reason;

MESH_DEBUG_PRINTLN("BLE client disconnected");
}

void ikoka_stick_nrf_board::begin() {
void IkokaStickNRFBoard::begin() {
// for future use, sub-classes SHOULD call this from their begin()
startup_reason = BD_STARTUP_NORMAL;

Expand Down Expand Up @@ -50,7 +48,7 @@ void ikoka_stick_nrf_board::begin() {
delay(10); // give sx1262 some time to power up
}

bool ikoka_stick_nrf_board::startOTAUpdate(const char* id, char reply[]) {
bool IkokaStickNRFBoard::startOTAUpdate(const char *id, char reply[]) {
// Config the peripheral connection with maximum bandwidth
// more SRAM required by SoftDevice
// Note: All config***() function must be called before begin()
Expand Down Expand Up @@ -91,9 +89,6 @@ bool ikoka_stick_nrf_board::startOTAUpdate(const char* id, char reply[]) {

strcpy(reply, "OK - started");
return true;


return false;
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#ifdef XIAO_NRF52

class ikoka_stick_nrf_board : public mesh::MainBoard {
class IkokaStickNRFBoard : public mesh::MainBoard {
protected:
uint8_t startup_reason;

Expand All @@ -16,9 +16,17 @@ class ikoka_stick_nrf_board : public mesh::MainBoard {
#if defined(P_LORA_TX_LED)
void onBeforeTransmit() override {
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED on
#if defined(LED_BLUE)
// turn off that annoying blue LED before transmitting
digitalWrite(LED_BLUE, HIGH);
#endif
}
void onAfterTransmit() override {
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED off
#if defined(LED_BLUE)
// do it after transmitting too, just in case
digitalWrite(LED_BLUE, HIGH);
#endif
}
#endif

Expand All @@ -38,15 +46,15 @@ class ikoka_stick_nrf_board : public mesh::MainBoard {
return (adcvalue * ADC_MULTIPLIER * AREF_VOLTAGE) / 4.096;
}

const char* getManufacturerName() const override {
return "Ikoka Stick (Xiao-nrf52)";
const char *getManufacturerName() const override {
return MANUFACTURER_STRING;
}

void reboot() override {
NVIC_SystemReset();
}

bool startOTAUpdate(const char* id, char reply[]) override;
bool startOTAUpdate(const char *id, char reply[]) override;
};

#endif
3 changes: 3 additions & 0 deletions variants/ikoka_stick_nrf/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ extends = ikoka_stick_nrf_baseboard
; No PA in this model, full 22dBm
build_flags =
${ikoka_stick_nrf_baseboard.build_flags}
-D MANUFACTURER_STRING='"Ikoka Stick-E22-22dBm (Xiao_nrf52)"'
-D LORA_TX_POWER=22
build_src_filter = ${nrf52840_xiao.build_src_filter}
+<helpers/*.cpp>
Expand All @@ -75,6 +76,7 @@ extends = ikoka_stick_nrf_baseboard
; cause distortion in the PA output. 20dBm in -> 30dBm out
build_flags =
${ikoka_stick_nrf_baseboard.build_flags}
-D MANUFACTURER_STRING='"Ikoka Stick-E22-30dBm (Xiao_nrf52)"'
-D LORA_TX_POWER=20
build_src_filter = ${nrf52840_xiao.build_src_filter}
+<helpers/*.cpp>
Expand All @@ -89,6 +91,7 @@ extends = ikoka_stick_nrf_baseboard
; to the rf amplifier frontend. 9dBm in -> 33dBm out
build_flags =
${ikoka_stick_nrf_baseboard.build_flags}
-D MANUFACTURER_STRING='"Ikoka Stick-E22-33dBm (Xiao_nrf52)"'
-D LORA_TX_POWER=9
build_src_filter = ${nrf52840_xiao.build_src_filter}
+<helpers/*.cpp>
Expand Down
2 changes: 1 addition & 1 deletion variants/ikoka_stick_nrf/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "target.h"
#include <helpers/ArduinoHelpers.h>

ikoka_stick_nrf_board board;
IkokaStickNRFBoard board;

#ifdef DISPLAY_CLASS
DISPLAY_CLASS display;
Expand Down
4 changes: 2 additions & 2 deletions variants/ikoka_stick_nrf/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/radiolib/RadioLibWrappers.h>
#include <ikoka_stick_nrf_board.h>
#include <IkokaStickNRFBoard.h>
#include <helpers/radiolib/CustomSX1262Wrapper.h>
#include <helpers/AutoDiscoverRTCClock.h>
#include <helpers/ArduinoHelpers.h>
Expand All @@ -16,7 +16,7 @@
extern MomentaryButton user_btn;
#endif

extern ikoka_stick_nrf_board board;
extern IkokaStickNRFBoard board;
extern WRAPPER_CLASS radio_driver;
extern AutoDiscoverRTCClock rtc_clock;
extern EnvironmentSensorManager sensors;
Expand Down
2 changes: 1 addition & 1 deletion variants/ikoka_stick_nrf/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extern "C"
#define LED_GREEN (13)
#define LED_BLUE (12)

#define LED_STATE_ON (1) // State when LED is litted
#define LED_STATE_ON (0) // State when LED is litted

// Buttons
#define PIN_BUTTON1 (PINS_COUNT)
Expand Down