Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
akmsensormanager.h@0:7a00359e701e, 2016-04-28 (annotated)
- Committer:
- masahikofukasawa
- Date:
- Thu Apr 28 21:12:04 2016 +0000
- Revision:
- 0:7a00359e701e
- Child:
- 2:11fe67783c4c
First commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
masahikofukasawa | 0:7a00359e701e | 1 | #ifndef AKMSENSORMANAGER_H |
masahikofukasawa | 0:7a00359e701e | 2 | #define AKMSENSORMANAGER_H |
masahikofukasawa | 0:7a00359e701e | 3 | |
masahikofukasawa | 0:7a00359e701e | 4 | #include "mbed.h" |
masahikofukasawa | 0:7a00359e701e | 5 | #include "SerialNano.h" |
masahikofukasawa | 0:7a00359e701e | 6 | #include "akmsensor.h" |
masahikofukasawa | 0:7a00359e701e | 7 | #include "Message.h" |
masahikofukasawa | 0:7a00359e701e | 8 | |
masahikofukasawa | 0:7a00359e701e | 9 | #define ANALOG_SENSOR_ID P0_4 |
masahikofukasawa | 0:7a00359e701e | 10 | #define ANALOG_SENSOR_ID_SUB P0_5 |
masahikofukasawa | 0:7a00359e701e | 11 | |
masahikofukasawa | 0:7a00359e701e | 12 | class AkmSensorManager { |
masahikofukasawa | 0:7a00359e701e | 13 | public: |
masahikofukasawa | 0:7a00359e701e | 14 | |
masahikofukasawa | 0:7a00359e701e | 15 | typedef enum { |
masahikofukasawa | 0:7a00359e701e | 16 | SUCCESS = 0, |
masahikofukasawa | 0:7a00359e701e | 17 | ERROR, |
masahikofukasawa | 0:7a00359e701e | 18 | } Status; |
masahikofukasawa | 0:7a00359e701e | 19 | |
masahikofukasawa | 0:7a00359e701e | 20 | AkmSensorManager(SerialNano* com, UARTService* service); |
masahikofukasawa | 0:7a00359e701e | 21 | Status init(); |
masahikofukasawa | 0:7a00359e701e | 22 | void setEventConnected(); |
masahikofukasawa | 0:7a00359e701e | 23 | void setEventDisconnected(); |
masahikofukasawa | 0:7a00359e701e | 24 | Status commandReceived(char* buf); |
masahikofukasawa | 0:7a00359e701e | 25 | bool isEvent(); |
masahikofukasawa | 0:7a00359e701e | 26 | Status processEvent(); |
masahikofukasawa | 0:7a00359e701e | 27 | |
masahikofukasawa | 0:7a00359e701e | 28 | |
masahikofukasawa | 0:7a00359e701e | 29 | void processCommand(); |
masahikofukasawa | 0:7a00359e701e | 30 | Status throwMessage(const Message *msg); |
masahikofukasawa | 0:7a00359e701e | 31 | |
masahikofukasawa | 0:7a00359e701e | 32 | private: |
masahikofukasawa | 0:7a00359e701e | 33 | |
masahikofukasawa | 0:7a00359e701e | 34 | AkmSensor* sensor; |
masahikofukasawa | 0:7a00359e701e | 35 | SerialNano* serial; |
masahikofukasawa | 0:7a00359e701e | 36 | UARTService* uartService; |
masahikofukasawa | 0:7a00359e701e | 37 | Message msg; |
masahikofukasawa | 0:7a00359e701e | 38 | |
masahikofukasawa | 0:7a00359e701e | 39 | uint8_t id; |
masahikofukasawa | 0:7a00359e701e | 40 | uint8_t subId; |
masahikofukasawa | 0:7a00359e701e | 41 | bool isEnabledBle; |
masahikofukasawa | 0:7a00359e701e | 42 | bool isEnabledUsb; |
masahikofukasawa | 0:7a00359e701e | 43 | |
masahikofukasawa | 0:7a00359e701e | 44 | bool eventCommandReceived; |
masahikofukasawa | 0:7a00359e701e | 45 | bool eventConnected; |
masahikofukasawa | 0:7a00359e701e | 46 | bool eventDisconnected; |
masahikofukasawa | 0:7a00359e701e | 47 | |
masahikofukasawa | 0:7a00359e701e | 48 | char userCommand[20]; |
masahikofukasawa | 0:7a00359e701e | 49 | |
masahikofukasawa | 0:7a00359e701e | 50 | AkmSensor* getAkmSensor(); |
masahikofukasawa | 0:7a00359e701e | 51 | uint8_t getId(PinName pin, uint8_t bits); |
masahikofukasawa | 0:7a00359e701e | 52 | void dataOut(char* str); |
masahikofukasawa | 0:7a00359e701e | 53 | }; |
masahikofukasawa | 0:7a00359e701e | 54 | |
masahikofukasawa | 0:7a00359e701e | 55 | #endif // AKMSENSORMANAGER_H |