diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-05-02 19:12:26 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-05-02 19:12:26 +1000 |
| commit | 1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (patch) | |
| tree | d162822b8fd7054f81bace0c7a65ab4d5e6f93ef /src/battery/include | |
| parent | a231fd1c8afedbeb14b0bc77d76bad61db986059 (diff) | |
| download | tangara-fw-1573a8c4cde1cd9528b422b2dcc598e37ffe94a7.tar.gz | |
WIP merge cyclically dependent components into one big component
Diffstat (limited to 'src/battery/include')
| -rw-r--r-- | src/battery/include/battery.hpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/battery/include/battery.hpp b/src/battery/include/battery.hpp deleted file mode 100644 index 314cd373..00000000 --- a/src/battery/include/battery.hpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2023 jacqueline <me@jacqueline.id.au> - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#pragma once - -#include <cstdint> - -#include "freertos/FreeRTOS.h" -#include "freertos/timers.h" - -#include "adc.hpp" -#include "samd.hpp" - -namespace battery { - -class Battery { - public: - Battery(drivers::Samd& samd, std::unique_ptr<drivers::AdcBattery> adc); - ~Battery(); - - auto Update() -> void; - - struct BatteryState { - uint_fast8_t percent; - uint32_t millivolts; - bool is_charging; - - bool operator==(const BatteryState& other) const { - return percent == other.percent && is_charging == other.is_charging; - } - }; - - auto State() -> std::optional<BatteryState>; - - private: - auto EmitEvent() -> void; - - drivers::Samd& samd_; - std::unique_ptr<drivers::AdcBattery> adc_; - - TimerHandle_t timer_; - std::mutex state_mutex_; - std::optional<BatteryState> state_; -}; - -} // namespace battery |
