Merge pull request #812 from khudson/source-cleanup
Ikoka Stick: Naming Convention, LED behavior, device strings
This commit is contained in:
@@ -1,28 +1,26 @@
|
|||||||
#ifdef XIAO_NRF52
|
#ifdef XIAO_NRF52
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "ikoka_stick_nrf_board.h"
|
#include "IkokaStickNRFBoard.h"
|
||||||
|
|
||||||
#include <bluefruit.h>
|
#include <bluefruit.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
|
||||||
static BLEDfu bledfu;
|
static BLEDfu bledfu;
|
||||||
|
|
||||||
static void connect_callback(uint16_t conn_handle)
|
static void connect_callback(uint16_t conn_handle) {
|
||||||
{
|
|
||||||
(void)conn_handle;
|
(void)conn_handle;
|
||||||
MESH_DEBUG_PRINTLN("BLE client connected");
|
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)conn_handle;
|
||||||
(void)reason;
|
(void)reason;
|
||||||
|
|
||||||
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
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()
|
// for future use, sub-classes SHOULD call this from their begin()
|
||||||
startup_reason = BD_STARTUP_NORMAL;
|
startup_reason = BD_STARTUP_NORMAL;
|
||||||
|
|
||||||
@@ -50,7 +48,7 @@ void ikoka_stick_nrf_board::begin() {
|
|||||||
delay(10); // give sx1262 some time to power up
|
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
|
// Config the peripheral connection with maximum bandwidth
|
||||||
// more SRAM required by SoftDevice
|
// more SRAM required by SoftDevice
|
||||||
// Note: All config***() function must be called before begin()
|
// Note: All config***() function must be called before begin()
|
||||||
@@ -91,9 +89,6 @@ bool ikoka_stick_nrf_board::startOTAUpdate(const char* id, char reply[]) {
|
|||||||
|
|
||||||
strcpy(reply, "OK - started");
|
strcpy(reply, "OK - started");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#ifdef XIAO_NRF52
|
#ifdef XIAO_NRF52
|
||||||
|
|
||||||
class ikoka_stick_nrf_board : public mesh::MainBoard {
|
class IkokaStickNRFBoard : public mesh::MainBoard {
|
||||||
protected:
|
protected:
|
||||||
uint8_t startup_reason;
|
uint8_t startup_reason;
|
||||||
|
|
||||||
@@ -16,9 +16,17 @@ public:
|
|||||||
#if defined(P_LORA_TX_LED)
|
#if defined(P_LORA_TX_LED)
|
||||||
void onBeforeTransmit() override {
|
void onBeforeTransmit() override {
|
||||||
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED on
|
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 {
|
void onAfterTransmit() override {
|
||||||
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED off
|
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
|
#endif
|
||||||
|
|
||||||
@@ -38,15 +46,15 @@ public:
|
|||||||
return (adcvalue * ADC_MULTIPLIER * AREF_VOLTAGE) / 4.096;
|
return (adcvalue * ADC_MULTIPLIER * AREF_VOLTAGE) / 4.096;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* getManufacturerName() const override {
|
const char *getManufacturerName() const override {
|
||||||
return "Ikoka Stick (Xiao-nrf52)";
|
return MANUFACTURER_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reboot() override {
|
void reboot() override {
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool startOTAUpdate(const char* id, char reply[]) override;
|
bool startOTAUpdate(const char *id, char reply[]) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -61,6 +61,7 @@ extends = ikoka_stick_nrf_baseboard
|
|||||||
; No PA in this model, full 22dBm
|
; No PA in this model, full 22dBm
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf_baseboard.build_flags}
|
||||||
|
-D MANUFACTURER_STRING='"Ikoka Stick-E22-22dBm (Xiao_nrf52)"'
|
||||||
-D LORA_TX_POWER=22
|
-D LORA_TX_POWER=22
|
||||||
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
@@ -75,6 +76,7 @@ extends = ikoka_stick_nrf_baseboard
|
|||||||
; cause distortion in the PA output. 20dBm in -> 30dBm out
|
; cause distortion in the PA output. 20dBm in -> 30dBm out
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf_baseboard.build_flags}
|
||||||
|
-D MANUFACTURER_STRING='"Ikoka Stick-E22-30dBm (Xiao_nrf52)"'
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=20
|
||||||
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
@@ -89,6 +91,7 @@ extends = ikoka_stick_nrf_baseboard
|
|||||||
; to the rf amplifier frontend. 9dBm in -> 33dBm out
|
; to the rf amplifier frontend. 9dBm in -> 33dBm out
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf_baseboard.build_flags}
|
||||||
|
-D MANUFACTURER_STRING='"Ikoka Stick-E22-33dBm (Xiao_nrf52)"'
|
||||||
-D LORA_TX_POWER=9
|
-D LORA_TX_POWER=9
|
||||||
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include <helpers/ArduinoHelpers.h>
|
#include <helpers/ArduinoHelpers.h>
|
||||||
|
|
||||||
ikoka_stick_nrf_board board;
|
IkokaStickNRFBoard board;
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
DISPLAY_CLASS display;
|
DISPLAY_CLASS display;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#define RADIOLIB_STATIC_ONLY 1
|
#define RADIOLIB_STATIC_ONLY 1
|
||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
#include <helpers/radiolib/RadioLibWrappers.h>
|
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||||
#include <ikoka_stick_nrf_board.h>
|
#include <IkokaStickNRFBoard.h>
|
||||||
#include <helpers/radiolib/CustomSX1262Wrapper.h>
|
#include <helpers/radiolib/CustomSX1262Wrapper.h>
|
||||||
#include <helpers/AutoDiscoverRTCClock.h>
|
#include <helpers/AutoDiscoverRTCClock.h>
|
||||||
#include <helpers/ArduinoHelpers.h>
|
#include <helpers/ArduinoHelpers.h>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
extern MomentaryButton user_btn;
|
extern MomentaryButton user_btn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern ikoka_stick_nrf_board board;
|
extern IkokaStickNRFBoard board;
|
||||||
extern WRAPPER_CLASS radio_driver;
|
extern WRAPPER_CLASS radio_driver;
|
||||||
extern AutoDiscoverRTCClock rtc_clock;
|
extern AutoDiscoverRTCClock rtc_clock;
|
||||||
extern EnvironmentSensorManager sensors;
|
extern EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ extern "C"
|
|||||||
#define LED_GREEN (13)
|
#define LED_GREEN (13)
|
||||||
#define LED_BLUE (12)
|
#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
|
// Buttons
|
||||||
#define PIN_BUTTON1 (PINS_COUNT)
|
#define PIN_BUTTON1 (PINS_COUNT)
|
||||||
|
|||||||
Reference in New Issue
Block a user