xrocusOS_ADXL355 version

Dependencies:   mbed SDFileSystem

Committer:
Inscape_ao
Date:
Sat May 18 03:28:31 2019 +0000
Revision:
10:db2be22bc2f9
Parent:
7:9ab8809f9693
Child:
17:c2709a9c0a68
add small Device Driver for ADXL372

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Inscape_ao 7:9ab8809f9693 1 #ifndef _DEVICEREPEATER_H_
Inscape_ao 7:9ab8809f9693 2 #define _DEVICEREPEATER_H_
Inscape_ao 7:9ab8809f9693 3
Inscape_ao 7:9ab8809f9693 4 #include "DeviceDriverInterface.h"
Inscape_ao 7:9ab8809f9693 5
Inscape_ao 7:9ab8809f9693 6 class DeviceRepeater
Inscape_ao 7:9ab8809f9693 7 {
Inscape_ao 7:9ab8809f9693 8 public:
Inscape_ao 7:9ab8809f9693 9 typedef enum device_attr_status {
Inscape_ao 7:9ab8809f9693 10 DEV_FATAL = -2,
Inscape_ao 7:9ab8809f9693 11 DEV_NOT_INIT = -1,
Inscape_ao 7:9ab8809f9693 12 DEV_READY = 0,
Inscape_ao 7:9ab8809f9693 13 DEV_RUNNING,
Inscape_ao 7:9ab8809f9693 14 DEV_REQ_STOP,
Inscape_ao 7:9ab8809f9693 15 } DevStatus;
Inscape_ao 7:9ab8809f9693 16 private:
Inscape_ao 7:9ab8809f9693 17 static const int DEFAULT_REPEAT_MAX_COUNT = 1;
Inscape_ao 7:9ab8809f9693 18 static const int DEFAULT_REPEAT_STRIDE = 5;
Inscape_ao 7:9ab8809f9693 19 static const int NOT_ID_SELECTED = -1;
Inscape_ao 7:9ab8809f9693 20 private:
Inscape_ao 10:db2be22bc2f9 21 int deviceID;
Inscape_ao 7:9ab8809f9693 22 int selected_id;
Inscape_ao 7:9ab8809f9693 23 DevStatus stat;
Inscape_ao 7:9ab8809f9693 24 DeviceDriver *pDriver;
Inscape_ao 7:9ab8809f9693 25
Inscape_ao 7:9ab8809f9693 26 /* Tick base class */
Inscape_ao 7:9ab8809f9693 27 Ticker *pClock;
Inscape_ao 7:9ab8809f9693 28 /* members for repeating */
Inscape_ao 7:9ab8809f9693 29 int repeat_max_count;
Inscape_ao 7:9ab8809f9693 30 int repeat_stride_sec;
Inscape_ao 7:9ab8809f9693 31 int repeat_remain_cnt;
Inscape_ao 7:9ab8809f9693 32 int repeat_remain_sec;
Inscape_ao 7:9ab8809f9693 33 private:
Inscape_ao 7:9ab8809f9693 34 DeviceRepeater(void);
Inscape_ao 7:9ab8809f9693 35 public:
Inscape_ao 10:db2be22bc2f9 36 DeviceRepeater(int deviceId, DeviceDriver *setDriver);
Inscape_ao 7:9ab8809f9693 37 bool setRepeatCount(int maxcount);
Inscape_ao 7:9ab8809f9693 38 bool setRepeatStride(int sec);
Inscape_ao 7:9ab8809f9693 39 bool setConfigId(int id);
Inscape_ao 7:9ab8809f9693 40 bool setConfigValue(int setValue);
Inscape_ao 7:9ab8809f9693 41 bool getConfigValue(int *retValue);
Inscape_ao 7:9ab8809f9693 42 bool start();
Inscape_ao 7:9ab8809f9693 43 bool stop();
Inscape_ao 7:9ab8809f9693 44 bool readyToStart();
Inscape_ao 7:9ab8809f9693 45 void tick();
Inscape_ao 7:9ab8809f9693 46 bool resetAllStatus(void);
Inscape_ao 7:9ab8809f9693 47 private:
Inscape_ao 7:9ab8809f9693 48 bool init();
Inscape_ao 7:9ab8809f9693 49 };
Inscape_ao 7:9ab8809f9693 50
Inscape_ao 7:9ab8809f9693 51 #endif /* _DEVICEREPEATER_H_ */