mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
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>
51 lines
1 KiB
C++
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
|
|
|