Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
Diff: akmakd.h
- Revision:
- 0:7a00359e701e
- Child:
- 6:c4401549d68f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/akmakd.h Thu Apr 28 21:12:04 2016 +0000 @@ -0,0 +1,60 @@ +#ifndef AKMAKD_H +#define AKMAKD_H + +#include "mbed.h" +#include "SerialNano.h" +#include "akmsensor.h" +#include "akmecompass.h" + +class AkmAkd : public AkmSensor +{ + +public: + + // SUB ID + typedef enum { // 5bit ID + SUB_ID_AK8963N = 0x1A, // 26 + SUB_ID_AK8963C = 0x1B, // 27 + SUB_ID_AK09911 = 0x0A, // 10 + SUB_ID_AK09912 = 0x09, // 9 + SUB_ID_AK09915 = 0x0D, // 13 + SUB_ID_AK09916C = 0x0E, // 14 + } SubIdAkd; + + /** + * Constructor. + * + */ + AkmAkd(); + + /** + * Destructor. + * + */ + virtual ~AkmAkd(); + virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); + virtual bool isEvent(); + virtual AkmSensor::Status startSensor(); + virtual AkmSensor::Status startSensor(const float sec); + virtual AkmSensor::Status stopSensor(); + virtual AkmSensor::Status readSensorData(Message* msg); + virtual Status requestCommand(Message* in, Message* out); + + void checkDRDY(); + void detectDRDY(); + int getSensorType(); + char* getSensorName(); + +private: + bool event; + uint8_t primaryId; + uint8_t subId; + + Ticker ticker; + AkmECompass* compass; + InterruptIn* drdy; + + char* sensorName; +}; + +#endif