Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
akmsensormanager.h
- Committer:
- coisme
- Date:
- 2016-05-05
- Revision:
- 2:11fe67783c4c
- Parent:
- 0:7a00359e701e
- Child:
- 6:c4401549d68f
File content as of revision 2:11fe67783c4c:
#ifndef AKMSENSORMANAGER_H #define AKMSENSORMANAGER_H #include "mbed.h" #include "SerialNano.h" #include "akmsensor.h" #include "Message.h" #include "debug.h" #ifdef REV_D #include "mcp342x.h" #endif #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); #ifdef REV_D int16_t getAdcData(MCP342X *mcp3428, MCP342X::AdcChannel ch, MCP342X::SampleSetting s); #endif }; #endif // AKMSENSORMANAGER_H