Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
- MeshCore-based Simple Sensor firmware - Heltec T114 without display - BME280 sensor support (temp/humidity/pressure) - Radio: 868.856018 MHz, SF7, BW62.5 kHz, CR4/7 - 2-byte path hash - PlatformIO project
40 lines
974 B
C++
40 lines
974 B
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <MeshCore.h>
|
|
#include <helpers/NRF52Board.h>
|
|
|
|
// built-ins
|
|
#define PIN_VBAT_READ 29
|
|
#define PIN_BAT_CTL 34
|
|
#define MV_LSB (3000.0F / 4096.0F) // 12-bit ADC with 3.0V input range
|
|
|
|
class HeltecMeshPocket : public NRF52BoardDCDC {
|
|
public:
|
|
HeltecMeshPocket() : NRF52Board("MESH_POCKET_OTA") {}
|
|
void begin();
|
|
|
|
uint16_t getBattMilliVolts() override {
|
|
int adcvalue = 0;
|
|
analogReadResolution(12);
|
|
analogReference(AR_INTERNAL_3_0);
|
|
pinMode(PIN_BAT_CTL, OUTPUT); // battery adc can be read only ctrl pin set to high
|
|
pinMode(PIN_VBAT_READ, INPUT);
|
|
digitalWrite(PIN_BAT_CTL, HIGH);
|
|
|
|
delay(10);
|
|
adcvalue = analogRead(PIN_VBAT_READ);
|
|
digitalWrite(PIN_BAT_CTL, LOW);
|
|
|
|
return (uint16_t)((float)adcvalue * MV_LSB * 4.9);
|
|
}
|
|
|
|
const char* getManufacturerName() const override {
|
|
return "Heltec MeshPocket";
|
|
}
|
|
|
|
void powerOff() override {
|
|
sd_power_system_off();
|
|
}
|
|
};
|