Line data Source code
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 ¶ms); 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 0 : bool has_consumed_energy() const override { return true; } 21 : 22 : /// returns true if battery monitor provides current info 23 0 : bool has_current() const override { return true; } 24 : 25 0 : void init(void) override {} 26 : 27 : private: 28 : 29 : AP_HAL::PWMSource pwm_source; 30 : }; 31 : 32 : #endif // AP_BATTERY_FUELLEVEL_PWM_ENABLED