Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
akmsensormanager.h
- Committer:
- masahikofukasawa
- Date:
- 2016-07-08
- Revision:
- 10:5c69b067d88a
- Parent:
- 6:c4401549d68f
- Child:
- 11:cef8dc1cf010
File content as of revision 10:5c69b067d88a:
#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(uint8_t id, uint8_t subid); void setEventConnected(); void setEventDisconnected(); Status commandReceived(char* buf); bool isEvent(); Status processEvent(); void processCommand(); Status throwMessage(const Message *msg); // void releaseTWI(); uint8_t getId(PinName pin, uint8_t bits); private: AkmSensor* sensor; SerialNano* serial; UARTService* uartService; Message msg; uint8_t primaryId; uint8_t subId; bool isEnabledBle; bool isEnabledUsb; bool eventCommandReceived; bool eventConnected; bool eventDisconnected; char userCommand[20]; AkmSensor* getAkmSensor(); void dataOut(char* str); #ifdef REV_D int16_t getAdcData(MCP342X *mcp3428, MCP342X::AdcChannel ch, MCP342X::SampleSetting s); #endif }; #endif // AKMSENSORMANAGER_H