blob: f0b8c8b3592f0ad55939deec166ded41a2250d21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#pragma once
#include <cstdint>
#include "esp_adc/adc_cali.h"
#include "esp_adc/adc_oneshot.h"
#include "esp_err.h"
#include "result.hpp"
namespace drivers {
class Battery {
public:
static auto Create() -> Battery* { return new Battery(); }
Battery();
~Battery();
/**
* Returns the current battery level in millivolts.
*/
auto Millivolts() -> uint32_t;
private:
adc_oneshot_unit_handle_t adc_handle_;
adc_cali_handle_t adc_calibration_handle_;
};
} // namespace drivers
|