support for battery if any + TPMS app to ext (#2129)

* batt initial
* batt widgets
* settings modify
* batt info screen
* ability to hide icon
* battView
* redo tmps
* hide curr + charge if no data
* fix flashing
This commit is contained in:
Totoo
2024-04-29 17:38:27 +02:00
committed by GitHub
parent f572b00391
commit f6a2d21624
23 changed files with 767 additions and 44 deletions

View File

@@ -27,11 +27,10 @@
#include <string>
#include "i2c_pp.hpp"
namespace battery {
namespace ads1110 {
using address_t = uint8_t;
using reg_t = uint16_t;
class ADS1110 {
public:
@@ -39,10 +38,11 @@ class ADS1110 {
: bus(bus), bus_address(bus_address), detected_(false) {}
void init();
bool detect();
bool isDetected() const { return detected_; }
float readVoltage();
void getBatteryInfo(float& batteryPercentage, float& voltage);
uint16_t readVoltage();
void getBatteryInfo(uint8_t& batteryPercentage, uint16_t& voltage);
private:
I2C& bus;
@@ -50,9 +50,8 @@ class ADS1110 {
bool detected_;
bool write(const uint8_t value);
bool detect();
};
} /* namespace ads1110 */
} // namespace battery
#endif /* __ADS1110_H__ */