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
29 lines
693 B
C++
29 lines
693 B
C++
#include <Arduino.h>
|
|
#include "ThinkNodeM3Board.h"
|
|
#include <Wire.h>
|
|
|
|
#include <bluefruit.h>
|
|
|
|
void ThinkNodeM3Board::begin() {
|
|
NRF52Board::begin();
|
|
btn_prev_state = HIGH;
|
|
|
|
Wire.begin();
|
|
|
|
delay(10); // give sx1262 some time to power up
|
|
}
|
|
|
|
uint16_t ThinkNodeM3Board::getBattMilliVolts() {
|
|
int adcvalue = 0;
|
|
|
|
analogReference(AR_INTERNAL_2_4);
|
|
analogReadResolution(ADC_RESOLUTION);
|
|
delay(10);
|
|
|
|
// ADC range is 0..2400mV and resolution is 12-bit (0..4095)
|
|
adcvalue = analogRead(PIN_VBAT_READ);
|
|
// Convert the raw value to compensated mv, taking the resistor-
|
|
// divider into account (providing the actual LIPO voltage)
|
|
return (uint16_t)((float)adcvalue * ADC_FACTOR);
|
|
}
|