Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Committer:
xinlei
Date:
Mon Aug 08 11:05:57 2016 +0000
Revision:
138:f8ab852e83e7
Parent:
136:a52821cdb108
Etisalat and Teleena APN.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
xinlei 100:dbcd3bc51758 1 #ifndef ACCELERATION_H
xinlei 100:dbcd3bc51758 2 #define ACCELERATION_H
xinlei 100:dbcd3bc51758 3 #include "mbed.h"
xinlei 100:dbcd3bc51758 4 #include "MMA7660.h"
xinlei 100:dbcd3bc51758 5 #include "AbstractReporter.h"
xinlei 100:dbcd3bc51758 6
xinlei 100:dbcd3bc51758 7
xinlei 100:dbcd3bc51758 8 class Acceleration: public AbstractReporter
xinlei 100:dbcd3bc51758 9 {
xinlei 100:dbcd3bc51758 10 public:
xinlei 123:311fa85af2b3 11 Acceleration(): deviceReady(false), sensor(SDA, SCL), timer() {
xinlei 100:dbcd3bc51758 12 oldValues[0] = 0;
xinlei 100:dbcd3bc51758 13 oldValues[1] = 0;
xinlei 100:dbcd3bc51758 14 oldValues[2] = 0;
xinlei 123:311fa85af2b3 15 timer.start();
xinlei 100:dbcd3bc51758 16 }
xinlei 100:dbcd3bc51758 17 virtual ~Acceleration() {}
xinlei 100:dbcd3bc51758 18 virtual bool init() {
xinlei 100:dbcd3bc51758 19 deviceReady = sensor.testConnection();
xinlei 100:dbcd3bc51758 20 return deviceReady;
xinlei 100:dbcd3bc51758 21 }
xinlei 100:dbcd3bc51758 22 virtual const char* name() const { return "Acc"; }
xinlei 136:a52821cdb108 23 virtual int read(char*, size_t, char*, size_t);
xinlei 100:dbcd3bc51758 24 private:
xinlei 100:dbcd3bc51758 25 bool deviceReady;
xinlei 100:dbcd3bc51758 26 MMA7660 sensor;
xinlei 100:dbcd3bc51758 27 float oldValues[3];
xinlei 123:311fa85af2b3 28 Timer timer;
xinlei 100:dbcd3bc51758 29 };
xinlei 100:dbcd3bc51758 30
xinlei 100:dbcd3bc51758 31 #endif /* ACCELERATION_H */