Browse Source

AP_BattMonitor: add static create method

mission-4.1.18
Lucas De Marchi 8 years ago committed by Francisco Ferreira
parent
commit
bd8f0a9e93
  1. 10
      libraries/AP_BattMonitor/AP_BattMonitor.h

10
libraries/AP_BattMonitor/AP_BattMonitor.h

@ -37,9 +37,13 @@ class AP_BattMonitor
friend class AP_BattMonitor_SMBus_Maxell; friend class AP_BattMonitor_SMBus_Maxell;
public: public:
static AP_BattMonitor create() { return AP_BattMonitor{}; }
/// Constructor constexpr AP_BattMonitor(AP_BattMonitor &&other) = default;
AP_BattMonitor();
/* Do not allow copies */
AP_BattMonitor(const AP_BattMonitor &other) = delete;
AP_BattMonitor &operator=(const AP_BattMonitor&) = delete;
// Battery monitor driver types // Battery monitor driver types
enum BattMonitor_Type { enum BattMonitor_Type {
@ -175,6 +179,8 @@ protected:
AP_Int8 _low_voltage_source; /// voltage type used for detection of low voltage event AP_Int8 _low_voltage_source; /// voltage type used for detection of low voltage event
private: private:
AP_BattMonitor();
BattMonitor_State state[AP_BATT_MONITOR_MAX_INSTANCES]; BattMonitor_State state[AP_BATT_MONITOR_MAX_INSTANCES];
AP_BattMonitor_Backend *drivers[AP_BATT_MONITOR_MAX_INSTANCES]; AP_BattMonitor_Backend *drivers[AP_BATT_MONITOR_MAX_INSTANCES];
uint8_t _num_instances; /// number of monitors uint8_t _num_instances; /// number of monitors

Loading…
Cancel
Save