CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_BattMonitor/AP_BattMonitor_FuelLevel_PWM.h
Views: 1798
1
#pragma once
2
3
#include "AP_BattMonitor_Analog.h"
4
5
#if AP_BATTERY_FUELLEVEL_PWM_ENABLED
6
7
#include "AP_BattMonitor.h"
8
9
class AP_BattMonitor_FuelLevel_PWM : public AP_BattMonitor_Analog
10
{
11
public:
12
13
/// Constructor
14
AP_BattMonitor_FuelLevel_PWM(AP_BattMonitor &mon, AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor_Params &params);
15
16
/// Read the battery voltage and current. Should be called at 10hz
17
void read() override;
18
19
/// returns true if battery monitor provides consumed energy info
20
bool has_consumed_energy() const override { return true; }
21
22
/// returns true if battery monitor provides current info
23
bool has_current() const override { return true; }
24
25
void init(void) override {}
26
27
private:
28
29
AP_HAL::PWMSource pwm_source;
30
};
31
32
#endif // AP_BATTERY_FUELLEVEL_PWM_ENABLED
33
34