The startOTAUpdate() is the same for all NRF52 boards. Use a common implementation for all boards that currently have a specific implementation. The following boards currently have an empty startOTAUpdate() for whatever reasons and therefore are not inheriting NRF52BoardOTA to keep the same state: Nano G2 Ultra, Seeed SenseCAP T1000-E, Wio WM1110. Signed-off-by: Frieder Schrempf <frieder@fris.de>
45 lines
933 B
C++
45 lines
933 B
C++
#pragma once
|
|
|
|
#include <MeshCore.h>
|
|
#include <Arduino.h>
|
|
#include <helpers/NRF52Board.h>
|
|
|
|
class KeepteenLT1Board : public NRF52BoardOTA {
|
|
protected:
|
|
uint8_t btn_prev_state;
|
|
|
|
public:
|
|
KeepteenLT1Board() : NRF52BoardOTA("KeepteenLT1_OTA") {}
|
|
void begin();
|
|
|
|
#define BATTERY_SAMPLES 8
|
|
|
|
uint16_t getBattMilliVolts() override {
|
|
analogReadResolution(12);
|
|
|
|
uint32_t raw = 0;
|
|
for (int i = 0; i < BATTERY_SAMPLES; i++) {
|
|
raw += analogRead(PIN_VBAT_READ);
|
|
}
|
|
raw = raw / BATTERY_SAMPLES;
|
|
return (ADC_MULTIPLIER * raw);
|
|
}
|
|
|
|
const char* getManufacturerName() const override {
|
|
return "Keepteen LT1";
|
|
}
|
|
|
|
#if defined(P_LORA_TX_LED)
|
|
void onBeforeTransmit() override {
|
|
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
|
|
}
|
|
void onAfterTransmit() override {
|
|
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
|
|
}
|
|
#endif
|
|
|
|
void powerOff() override {
|
|
sd_power_system_off();
|
|
}
|
|
};
|