Fork of Tangara with customizations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
tangara-fw/src/drivers/include/battery.hpp

34 lines
603 B

/*
* 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