Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
akmakd.h@0:7a00359e701e, 2016-04-28 (annotated)
- Committer:
- masahikofukasawa
- Date:
- Thu Apr 28 21:12:04 2016 +0000
- Revision:
- 0:7a00359e701e
- Child:
- 6:c4401549d68f
First commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
masahikofukasawa | 0:7a00359e701e | 1 | #ifndef AKMAKD_H |
masahikofukasawa | 0:7a00359e701e | 2 | #define AKMAKD_H |
masahikofukasawa | 0:7a00359e701e | 3 | |
masahikofukasawa | 0:7a00359e701e | 4 | #include "mbed.h" |
masahikofukasawa | 0:7a00359e701e | 5 | #include "SerialNano.h" |
masahikofukasawa | 0:7a00359e701e | 6 | #include "akmsensor.h" |
masahikofukasawa | 0:7a00359e701e | 7 | #include "akmecompass.h" |
masahikofukasawa | 0:7a00359e701e | 8 | |
masahikofukasawa | 0:7a00359e701e | 9 | class AkmAkd : public AkmSensor |
masahikofukasawa | 0:7a00359e701e | 10 | { |
masahikofukasawa | 0:7a00359e701e | 11 | |
masahikofukasawa | 0:7a00359e701e | 12 | public: |
masahikofukasawa | 0:7a00359e701e | 13 | |
masahikofukasawa | 0:7a00359e701e | 14 | // SUB ID |
masahikofukasawa | 0:7a00359e701e | 15 | typedef enum { // 5bit ID |
masahikofukasawa | 0:7a00359e701e | 16 | SUB_ID_AK8963N = 0x1A, // 26 |
masahikofukasawa | 0:7a00359e701e | 17 | SUB_ID_AK8963C = 0x1B, // 27 |
masahikofukasawa | 0:7a00359e701e | 18 | SUB_ID_AK09911 = 0x0A, // 10 |
masahikofukasawa | 0:7a00359e701e | 19 | SUB_ID_AK09912 = 0x09, // 9 |
masahikofukasawa | 0:7a00359e701e | 20 | SUB_ID_AK09915 = 0x0D, // 13 |
masahikofukasawa | 0:7a00359e701e | 21 | SUB_ID_AK09916C = 0x0E, // 14 |
masahikofukasawa | 0:7a00359e701e | 22 | } SubIdAkd; |
masahikofukasawa | 0:7a00359e701e | 23 | |
masahikofukasawa | 0:7a00359e701e | 24 | /** |
masahikofukasawa | 0:7a00359e701e | 25 | * Constructor. |
masahikofukasawa | 0:7a00359e701e | 26 | * |
masahikofukasawa | 0:7a00359e701e | 27 | */ |
masahikofukasawa | 0:7a00359e701e | 28 | AkmAkd(); |
masahikofukasawa | 0:7a00359e701e | 29 | |
masahikofukasawa | 0:7a00359e701e | 30 | /** |
masahikofukasawa | 0:7a00359e701e | 31 | * Destructor. |
masahikofukasawa | 0:7a00359e701e | 32 | * |
masahikofukasawa | 0:7a00359e701e | 33 | */ |
masahikofukasawa | 0:7a00359e701e | 34 | virtual ~AkmAkd(); |
masahikofukasawa | 0:7a00359e701e | 35 | virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); |
masahikofukasawa | 0:7a00359e701e | 36 | virtual bool isEvent(); |
masahikofukasawa | 0:7a00359e701e | 37 | virtual AkmSensor::Status startSensor(); |
masahikofukasawa | 0:7a00359e701e | 38 | virtual AkmSensor::Status startSensor(const float sec); |
masahikofukasawa | 0:7a00359e701e | 39 | virtual AkmSensor::Status stopSensor(); |
masahikofukasawa | 0:7a00359e701e | 40 | virtual AkmSensor::Status readSensorData(Message* msg); |
masahikofukasawa | 0:7a00359e701e | 41 | virtual Status requestCommand(Message* in, Message* out); |
masahikofukasawa | 0:7a00359e701e | 42 | |
masahikofukasawa | 0:7a00359e701e | 43 | void checkDRDY(); |
masahikofukasawa | 0:7a00359e701e | 44 | void detectDRDY(); |
masahikofukasawa | 0:7a00359e701e | 45 | int getSensorType(); |
masahikofukasawa | 0:7a00359e701e | 46 | char* getSensorName(); |
masahikofukasawa | 0:7a00359e701e | 47 | |
masahikofukasawa | 0:7a00359e701e | 48 | private: |
masahikofukasawa | 0:7a00359e701e | 49 | bool event; |
masahikofukasawa | 0:7a00359e701e | 50 | uint8_t primaryId; |
masahikofukasawa | 0:7a00359e701e | 51 | uint8_t subId; |
masahikofukasawa | 0:7a00359e701e | 52 | |
masahikofukasawa | 0:7a00359e701e | 53 | Ticker ticker; |
masahikofukasawa | 0:7a00359e701e | 54 | AkmECompass* compass; |
masahikofukasawa | 0:7a00359e701e | 55 | InterruptIn* drdy; |
masahikofukasawa | 0:7a00359e701e | 56 | |
masahikofukasawa | 0:7a00359e701e | 57 | char* sensorName; |
masahikofukasawa | 0:7a00359e701e | 58 | }; |
masahikofukasawa | 0:7a00359e701e | 59 | |
masahikofukasawa | 0:7a00359e701e | 60 | #endif |