diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-28 13:26:53 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-28 13:26:53 +1000 |
| commit | 3a0c42f9240eedfbc6a1e94ad3a59c52664fb5b5 (patch) | |
| tree | 0505db40de6fceaf5829548ef86f4cb53b739bcb /src/drivers/include | |
| parent | a1327763ab70dbf4996e032dd227de368f78f4ad (diff) | |
| download | tangara-fw-3a0c42f9240eedfbc6a1e94ad3a59c52664fb5b5.tar.gz | |
Move battery measurement to its own class
Diffstat (limited to 'src/drivers/include')
| -rw-r--r-- | src/drivers/include/adc.hpp (renamed from src/drivers/include/battery.hpp) | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/drivers/include/battery.hpp b/src/drivers/include/adc.hpp index 64a00135..3e94a9ee 100644 --- a/src/drivers/include/battery.hpp +++ b/src/drivers/include/adc.hpp @@ -15,25 +15,23 @@ namespace drivers { -class Battery { +/* + * Handles measuring the battery's current voltage. + */ +class AdcBattery { public: - static auto Create() -> Battery* { return new Battery(); } - Battery(); - ~Battery(); + static auto Create() -> AdcBattery* { return new AdcBattery(); } + AdcBattery(); + ~AdcBattery(); /** * Returns the current battery level in millivolts. */ auto Millivolts() -> uint32_t; - auto UpdatePercent() -> bool; - auto Percent() -> uint_fast8_t { return percent_; } - private: adc_oneshot_unit_handle_t adc_handle_; adc_cali_handle_t adc_calibration_handle_; - - uint_fast8_t percent_; }; } // namespace drivers |
