Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
akmakd.h@10:5c69b067d88a, 2016-07-08 (annotated)
- Committer:
- masahikofukasawa
- Date:
- Fri Jul 08 22:26:26 2016 +0000
- Revision:
- 10:5c69b067d88a
- Parent:
- 9:6fa3e7b17c27
- Child:
- 13:d008249f0359
RevD with AK09970 Release to Japan.
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 | 6:c4401549d68f | 17 | SUB_ID_AK8963C = 0x1C, // 28 |
masahikofukasawa | 10:5c69b067d88a | 18 | SUB_ID_AK09911C = 0x0A, // 10 |
masahikofukasawa | 10:5c69b067d88a | 19 | SUB_ID_AK09912C = 0x09, // 9 |
masahikofukasawa | 10:5c69b067d88a | 20 | SUB_ID_AK09915C = 0x0D, // 13 |
masahikofukasawa | 0:7a00359e701e | 21 | SUB_ID_AK09916C = 0x0E, // 14 |
masahikofukasawa | 10:5c69b067d88a | 22 | SUB_ID_AK09916D = 0x0F, // 15 |
masahikofukasawa | 10:5c69b067d88a | 23 | SUB_ID_AK09915D = 0x10, // 16 |
masahikofukasawa | 0:7a00359e701e | 24 | } SubIdAkd; |
masahikofukasawa | 0:7a00359e701e | 25 | |
masahikofukasawa | 0:7a00359e701e | 26 | /** |
masahikofukasawa | 0:7a00359e701e | 27 | * Constructor. |
masahikofukasawa | 0:7a00359e701e | 28 | * |
masahikofukasawa | 0:7a00359e701e | 29 | */ |
masahikofukasawa | 0:7a00359e701e | 30 | AkmAkd(); |
masahikofukasawa | 0:7a00359e701e | 31 | |
masahikofukasawa | 0:7a00359e701e | 32 | /** |
masahikofukasawa | 0:7a00359e701e | 33 | * Destructor. |
masahikofukasawa | 0:7a00359e701e | 34 | * |
masahikofukasawa | 0:7a00359e701e | 35 | */ |
masahikofukasawa | 0:7a00359e701e | 36 | virtual ~AkmAkd(); |
masahikofukasawa | 0:7a00359e701e | 37 | virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); |
masahikofukasawa | 0:7a00359e701e | 38 | virtual bool isEvent(); |
masahikofukasawa | 0:7a00359e701e | 39 | virtual AkmSensor::Status startSensor(); |
masahikofukasawa | 0:7a00359e701e | 40 | virtual AkmSensor::Status startSensor(const float sec); |
masahikofukasawa | 0:7a00359e701e | 41 | virtual AkmSensor::Status stopSensor(); |
masahikofukasawa | 0:7a00359e701e | 42 | virtual AkmSensor::Status readSensorData(Message* msg); |
masahikofukasawa | 0:7a00359e701e | 43 | virtual Status requestCommand(Message* in, Message* out); |
masahikofukasawa | 0:7a00359e701e | 44 | |
masahikofukasawa | 0:7a00359e701e | 45 | void checkDRDY(); |
masahikofukasawa | 0:7a00359e701e | 46 | void detectDRDY(); |
masahikofukasawa | 0:7a00359e701e | 47 | int getSensorType(); |
masahikofukasawa | 0:7a00359e701e | 48 | char* getSensorName(); |
masahikofukasawa | 0:7a00359e701e | 49 | |
masahikofukasawa | 0:7a00359e701e | 50 | private: |
masahikofukasawa | 0:7a00359e701e | 51 | bool event; |
masahikofukasawa | 0:7a00359e701e | 52 | uint8_t primaryId; |
masahikofukasawa | 0:7a00359e701e | 53 | uint8_t subId; |
masahikofukasawa | 0:7a00359e701e | 54 | |
masahikofukasawa | 0:7a00359e701e | 55 | Ticker ticker; |
masahikofukasawa | 0:7a00359e701e | 56 | AkmECompass* compass; |
masahikofukasawa | 0:7a00359e701e | 57 | InterruptIn* drdy; |
masahikofukasawa | 9:6fa3e7b17c27 | 58 | AkmECompass::OperationMode mode; |
masahikofukasawa | 9:6fa3e7b17c27 | 59 | AkmECompass::Nsf nsf; |
masahikofukasawa | 9:6fa3e7b17c27 | 60 | AkmECompass::Sdr sdr; |
masahikofukasawa | 0:7a00359e701e | 61 | char* sensorName; |
masahikofukasawa | 0:7a00359e701e | 62 | }; |
masahikofukasawa | 0:7a00359e701e | 63 | |
masahikofukasawa | 0:7a00359e701e | 64 | #endif |