summaryrefslogtreecommitdiff
path: root/src/drivers/include/battery.hpp
blob: d50bb20f50ecddc59fe253df8b30d1f76a607f09 (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
#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:
  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