Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
akmsensormanager.h
- Committer:
- masahikofukasawa
- Date:
- 2017-03-17
- Revision:
- 29:b488d2c89fba
- Parent:
- 27:41aa9fb23a2f
- Child:
- 34:1ea3357c8d9a
File content as of revision 29:b488d2c89fba:
#ifndef AKMSENSORMANAGER_H #define AKMSENSORMANAGER_H #include "mbed.h" #include "SerialNano.h" #include "akmsensor.h" #include "Message.h" #include "debug.h" #include "ble/BLE.h" #include "mcp342x.h" #include "akmakd.h" #define ANALOG_SENSOR_ID P0_4 #define ANALOG_SENSOR_ID_SUB P0_5 #define MAX_SENSOR_NUM 2 class AkmSensorManager { public: typedef enum { SUCCESS = 0, ERROR, } Status; AkmSensorManager(SerialNano* com); Status init(uint8_t id, uint8_t subid); void setBleUartService(UARTService* service); void setEventConnected(); void setEventDisconnected(); Status commandReceived(char* buf); bool isEvent(); Status processEvent(); char* getSensorName(); void processCommand(); Status throwMessage(const Message *msg); // void releaseTWI(); uint8_t getId(PinName pin, uint8_t bits); void detectDRDY(); private: AkmSensor* sensor[MAX_SENSOR_NUM]; SerialNano* serial; UARTService* uartService; Message msg; Timeout t; InterruptIn* interrupt; uint8_t primaryId; uint8_t subId; uint8_t sensorIndex; uint8_t sensorNum; bool isEnabledBle; bool isEnabledUsb; bool eventCommandReceived; bool eventConnected; bool eventDisconnected; char userCommand[20]; AkmAkd::InterruptMode drdyType; bool checkAkmSensor(); void dataOut(char* str); int16_t getAdcData(MCP342X *mcp3428, MCP342X::AdcChannel ch, MCP342X::SampleSetting s); void dummyCallbackForCommandReceived(); char* my_strcat(char* str1, char* str2); }; #endif // AKMSENSORMANAGER_H