Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
Diff: akmsensormanager.h
- Revision:
- 0:7a00359e701e
- Child:
- 2:11fe67783c4c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/akmsensormanager.h Thu Apr 28 21:12:04 2016 +0000 @@ -0,0 +1,55 @@ +#ifndef AKMSENSORMANAGER_H +#define AKMSENSORMANAGER_H + +#include "mbed.h" +#include "SerialNano.h" +#include "akmsensor.h" +#include "Message.h" + +#define ANALOG_SENSOR_ID P0_4 +#define ANALOG_SENSOR_ID_SUB P0_5 + +class AkmSensorManager { + public: + + typedef enum { + SUCCESS = 0, + ERROR, + } Status; + + AkmSensorManager(SerialNano* com, UARTService* service); + Status init(); + void setEventConnected(); + void setEventDisconnected(); + Status commandReceived(char* buf); + bool isEvent(); + Status processEvent(); + + + void processCommand(); + Status throwMessage(const Message *msg); + + private: + + AkmSensor* sensor; + SerialNano* serial; + UARTService* uartService; + Message msg; + + uint8_t id; + uint8_t subId; + bool isEnabledBle; + bool isEnabledUsb; + + bool eventCommandReceived; + bool eventConnected; + bool eventDisconnected; + + char userCommand[20]; + + AkmSensor* getAkmSensor(); + uint8_t getId(PinName pin, uint8_t bits); + void dataOut(char* str); +}; + +#endif // AKMSENSORMANAGER_H