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.
37 lines
1011 B
37 lines
1011 B
#pragma once |
|
|
|
#include "AP_BattMonitor.h" |
|
#include "AP_BattMonitor_Backend.h" |
|
|
|
class AP_BattMonitor_FuelFlow : public AP_BattMonitor_Backend |
|
{ |
|
public: |
|
|
|
/// Constructor |
|
AP_BattMonitor_FuelFlow(AP_BattMonitor &mon, AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor_Params ¶ms); |
|
|
|
/// Read the battery voltage and current. Should be called at 10hz |
|
void read() override; |
|
|
|
/// returns true if battery monitor provides consumed energy info |
|
bool has_consumed_energy() const override { return true; } |
|
|
|
/// returns true if battery monitor provides current info |
|
bool has_current() const override { return true; } |
|
|
|
void init(void) override {} |
|
|
|
void request_info(void)override {}; |
|
void request_history(void)override {}; |
|
|
|
private: |
|
void irq_handler(uint8_t pin, bool pin_state, uint32_t timestamp); |
|
|
|
struct IrqState { |
|
uint32_t pulse_count; |
|
uint32_t total_us; |
|
uint32_t last_pulse_us; |
|
} irq_state; |
|
|
|
int8_t last_pin = -1; |
|
};
|
|
|