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_FuelFlow.h
Views: 1798
1
#pragma once
2
3
#include "AP_BattMonitor_Analog.h"
4
5
#if AP_BATTERY_FUELFLOW_ENABLED
6
7
#include "AP_BattMonitor.h"
8
9
class AP_BattMonitor_FuelFlow : public AP_BattMonitor_Analog
10
{
11
public:
12
13
/// Constructor
14
AP_BattMonitor_FuelFlow(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
void irq_handler(uint8_t pin, bool pin_state, uint32_t timestamp);
29
30
struct IrqState {
31
uint32_t pulse_count;
32
uint32_t total_us;
33
uint32_t last_pulse_us;
34
} irq_state;
35
36
int8_t last_pin = -1;
37
};
38
39
#endif // AP_BATTERY_FUELFLOW_ENABLED
40
41