Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Acceleration.h Source File

Acceleration.h

00001 #ifndef ACCELERATION_H
00002 #define ACCELERATION_H
00003 #include "mbed.h"
00004 #include "MMA7660.h"
00005 #include "AbstractReporter.h"
00006 
00007 
00008 class Acceleration: public AbstractReporter
00009 {
00010 public:
00011         Acceleration(): deviceReady(false), sensor(SDA, SCL), timer() {
00012                 oldValues[0] = 0;
00013                 oldValues[1] = 0;
00014                 oldValues[2] = 0;
00015                 timer.start();
00016         }
00017         virtual ~Acceleration() {}
00018         virtual bool init() {
00019                 deviceReady = sensor.testConnection();
00020                 return deviceReady;
00021         }
00022         virtual const char* name() const { return "Acc"; }
00023         virtual int read(char*, size_t, char*, size_t);
00024 private:
00025         bool deviceReady;
00026         MMA7660 sensor;
00027         float oldValues[3];
00028         Timer timer;
00029 };
00030 
00031 #endif /* ACCELERATION_H */