AP_Notify: add static create method

This commit is contained in:
Lucas De Marchi 2017-08-23 07:54:39 -07:00 committed by Francisco Ferreira
parent de680dac5b
commit 9463dbb408
1 changed files with 8 additions and 2 deletions

View File

@ -40,14 +40,19 @@ class AP_Notify
friend class RGBLed; // RGBLed needs access to notify parameters
friend class Display; // Display needs access to notify parameters
public:
// Constructor
AP_Notify();
static AP_Notify create() { return AP_Notify{}; }
// get singleton instance
static AP_Notify *instance(void) {
return _instance;
}
constexpr AP_Notify(AP_Notify &&other) = default;
/* Do not allow copies */
AP_Notify(const AP_Notify &other) = delete;
AP_Notify &operator=(const AP_Notify&) = delete;
// Oreo LED Themes
enum Oreo_LED_Theme {
OreoLED_Disabled = 0, // Disabled the OLED driver entirely
@ -140,6 +145,7 @@ public:
static const struct AP_Param::GroupInfo var_info[];
private:
AP_Notify();
static AP_Notify *_instance;