honvl / seeed-xiao-nrf52840-battery Goto Github PK
View Code? Open in Web Editor NEWArduino library to sense Seeed Xiao NRF52840 Battery voltage or charging state on non-Mbed 1.0.0 firmware
Arduino library to sense Seeed Xiao NRF52840 Battery voltage or charging state on non-Mbed 1.0.0 firmware
There is a comment on Xiao wiki :
Q3: What are the considerations when using XIAO nRF52840 (Sense) for battery charging?โ
When P0.14 (D14) turns off the ADC function at a high level of 3.3V, P0.31 will be at the input voltage limit of 3.6V. There is a risk of burning out the P0.31 pin.
Currently for this issue, we recommend that users do not turn off the ADC function of P0.14 (D14) or set P0.14 (D14) to high during battery charging.
According to this suggestions we should add a procedure to allow battery measurement only when NOT charging.
During charging, the function GetBatteryVolatge should return 0 or error.
something like
float Xiao::GetBatteryVoltage() {
if ( !digitalRead(BAT_CHARGE_STATE) == LOW ) {
digitalWrite(VBAT_ENABLE, LOW);
uint32_t adcCount = analogRead(PIN_VBAT);
float adcVoltage = adcCount * VBAT_MV_PER_LBS;
float vBat = adcVoltage * (1510.0 / 510.0);
digitalWrite(VBAT_ENABLE, HIGH);
return vBat;
}
else { return 0;}
}
bool Xiao::IsChargingBattery() { return digitalRead(BAT_CHARGE_STATE) == LOW; }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.