Orefatoi / Mbed 2 deprecated afero_node_suntory_171018

Dependencies:   mbed MMA8451Q USBDevice WakeUp vt100

Fork of afero_node_suntory_2017_06_15 by Orefatoi

Revision:
21:d03c7bbb9f37
Parent:
19:b45b077c88bc
diff -r 47ca1cd230e6 -r d03c7bbb9f37 sensors/Accelerometer/Accelerometer_Sekisan.hpp
--- a/sensors/Accelerometer/Accelerometer_Sekisan.hpp	Mon Jun 05 07:59:10 2017 +0000
+++ b/sensors/Accelerometer/Accelerometer_Sekisan.hpp	Fri Jun 09 01:49:53 2017 +0000
@@ -8,47 +8,49 @@
 #include "WakeUp.h"
 #include "Preferences.hpp"
 #include "TimeEventHandler.hpp"
+#include "Singletoned.hpp"
 #include "MCUResetReason.hpp"
 
-namespace MaruSolSensorManager
+class Accelerometer_Sekisan :
+    public ToDo,
+    public TimeEventHandler<Accelerometer_Sekisan>,
+    public Singletoned<Accelerometer_Sekisan>
 {
-    class Accelerometer_Sekisan : public ToDo, public TimeEventHandler<Accelerometer_Sekisan>
+    MMA8451Q *acc;
+    Accelerometer_Sekisan();
+    ~Accelerometer_Sekisan();
+    void go();
+    virtual void checkIntervalUpdate();
+    float read_count;
+    void (Accelerometer_Sekisan::*ptr_to_go)();
+    void go_NormalOperation();
+    void go_WhileWaitingForSuccess();
+    void readSensorAndIncCount();
+    float sensing_interval;
+    class SekisanCounter
     {
-        MMA8451Q *acc;
-        Accelerometer_Sekisan();
-        ~Accelerometer_Sekisan();
-        void go();
-        virtual void checkIntervalUpdate();
-        float read_count;
-        void (Accelerometer_Sekisan::*ptr_to_go)();
-        void go_NormalOperation();
-        void go_WhileWaitingForSuccess();
-        void readSensorAndIncCount();
-        float sensing_interval;
-        class SekisanCounter
+        friend Accelerometer_Sekisan;
+        int32_t sekisanchi;
+        uint16_t sampling_count;
+        uint32_t sampling_interval;
+        int32_t prev_x, prev_y, prev_z;
+    public:
+        SekisanCounter();
+        inline uint32_t get_sampling_interval()
         {
-            friend Accelerometer_Sekisan;
-            int32_t sekisanchi;
-            uint16_t sampling_count;
-            uint32_t sampling_interval;
-            int32_t prev_x, prev_y, prev_z;
-        public:
-            SekisanCounter();
-            inline uint32_t get_sampling_interval()
-            {
-                return sampling_interval;
-            }
-            void push(int32_t, int32_t, int32_t);
-            int32_t pop();
-        };
-        SekisanCounter *sekisan_counter;
-    public:
-        friend class TimeEventHandler;
-        virtual void toJSON(char*);
-        virtual void getBytes(uint8_t*){}
-        virtual void toBASE64(char *buf, PREFERENCES::_crc32 *crc32){}
-        virtual void success();
+            return sampling_interval;
+        }
+        void push(int32_t, int32_t, int32_t);
+        int32_t pop();
     };
+    SekisanCounter *sekisan_counter;
+public:
+    friend class TimeEventHandler;
+    friend class Singletoned;
+    virtual void toJSON(char*);
+    virtual void getBytes(uint8_t*){}
+    virtual void toBASE64(char *buf, PREFERENCES::_crc32 *crc32){}
+    virtual void success();
 };
 
 #endif //_MARUSOL_SENSOR_MANAGER_TEMP_H_
\ No newline at end of file