2025-09-23 19:39:11 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <MeshCore.h>
|
|
|
|
|
#include <Arduino.h>
|
2025-12-12 19:01:15 +07:00
|
|
|
#include <helpers/NRF52Board.h>
|
2025-09-23 19:39:11 +02:00
|
|
|
|
|
|
|
|
// built-ins
|
|
|
|
|
#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096
|
|
|
|
|
|
|
|
|
|
#define VBAT_DIVIDER (0.5F) // 150K + 150K voltage divider on VBAT
|
|
|
|
|
#define VBAT_DIVIDER_COMP (2.0F) // Compensation factor for the VBAT divider
|
|
|
|
|
|
|
|
|
|
#define PIN_VBAT_READ (4)
|
|
|
|
|
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
|
|
|
|
|
|
2025-12-20 10:44:13 +01:00
|
|
|
class TechoBoard : public NRF52BoardDCDC {
|
2025-09-23 19:39:11 +02:00
|
|
|
public:
|
2025-12-20 10:44:13 +01:00
|
|
|
TechoBoard() : NRF52Board("TECHO_OTA") {}
|
2025-09-23 19:39:11 +02:00
|
|
|
void begin();
|
|
|
|
|
uint16_t getBattMilliVolts() override;
|
|
|
|
|
|
|
|
|
|
const char* getManufacturerName() const override {
|
|
|
|
|
return "LilyGo T-Echo";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void powerOff() override {
|
|
|
|
|
#ifdef LED_RED
|
|
|
|
|
digitalWrite(LED_RED, LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef LED_GREEN
|
|
|
|
|
digitalWrite(LED_GREEN, LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef LED_BLUE
|
|
|
|
|
digitalWrite(LED_BLUE, LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef DISP_BACKLIGHT
|
|
|
|
|
digitalWrite(DISP_BACKLIGHT, LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef PIN_PWR_EN
|
|
|
|
|
digitalWrite(PIN_PWR_EN, LOW);
|
|
|
|
|
#endif
|
|
|
|
|
sd_power_system_off();
|
|
|
|
|
}
|
|
|
|
|
};
|