MeshCore/variants/wio_wm1110/WioWM1110Board.h
Frieder Schrempf e3bb225efb
Deduplicate DC/DC regulator enable for NRF52 boards
Some NRF52 boards are able to use the internal power-efficient DC/DC
regulator. Add a new class that can be inherited by board classes to
enable this feature and reduce the power consumption.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
2025-12-17 10:29:14 +01:00

51 lines
1 KiB
C++

#pragma once
#include <MeshCore.h>
#include <Arduino.h>
#include <helpers/NRF52Board.h>
#ifdef WIO_WM1110
#ifdef Serial
#undef Serial
#endif
#define Serial Serial1
class WioWM1110Board : public NRF52BoardDCDC {
public:
void begin();
#if defined(LED_GREEN)
void onBeforeTransmit() override {
digitalWrite(LED_RED, HIGH);
}
void onAfterTransmit() override {
digitalWrite(LED_RED, LOW);
}
#endif
uint16_t getBattMilliVolts() override {
int adcvalue = 0;
analogReadResolution(12);
analogReference(AR_INTERNAL_3_0);
delay(10);
adcvalue = analogRead(BATTERY_PIN);
return (adcvalue * ADC_MULTIPLIER * AREF_VOLTAGE * 1000.0) / 4096.0;
}
const char* getManufacturerName() const override {
return "Seeed Wio WM1110";
}
bool startOTAUpdate(const char* id, char reply[]) override;
void enableSensorPower(bool enable) {
digitalWrite(SENSOR_POWER_PIN, enable ? HIGH : LOW);
if (enable) {
delay(100);
}
}
};
#endif