Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
akmakd.h
- Committer:
- masahikofukasawa
- Date:
- 2017-03-17
- Revision:
- 29:b488d2c89fba
- Parent:
- 27:41aa9fb23a2f
- Child:
- 34:1ea3357c8d9a
File content as of revision 29:b488d2c89fba:
#ifndef AKMAKD_H #define AKMAKD_H #include "mbed.h" #include "SerialNano.h" #include "akmsensor.h" #include "akmecompass.h" #define AKDP_MAG_SENSITIVITY (0.15) // [uT/LSB] #define AKDP_POLLING_FREQUENCY (200.0) // [Hz] class AkmAkd : public AkmSensor { public: typedef AkmSensor base; // SUB ID typedef enum { // 5bit AKDP Secondary ID SUB_ID_AK8963N = 0x1A, // 26 SUB_ID_AK8963C = 0x1C, // 28 SUB_ID_AK09911C = 0x0A, // 10 SUB_ID_AK09912C = 0x09, // 9 SUB_ID_AK09915C = 0x0D, // 13 SUB_ID_AK09916C = 0x0E, // 14 SUB_ID_AK09916D = 0x0F, // 15 SUB_ID_AK09915D = 0x10, // 16 SUB_ID_AK09918 = 0x11, // 17 } SubIdAkd; typedef enum { INTERRUPT_DISABLED = 0x00, // Polling INTERRUPT_ENABLED_PP = 0x01, // Push-Pull INTERRUPT_ENABLED_OD = 0x02, // Open drain } InterruptMode; /** * Constructor. * */ AkmAkd(); /** * Destructor. * */ virtual ~AkmAkd(); virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); 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); virtual void setEvent(); int getSensorType(); InterruptMode getInterrupt(uint8_t primaryId, uint8_t subId); AkmSensor::Status checkSensor( const uint8_t primaryid, const uint8_t subid, AkmECompass::DeviceId* devid); private: Ticker ticker; AkmECompass* compass; // InterruptIn* drdy; AkmECompass::OperationMode mode; AkmECompass::Nsf nsf; AkmECompass::Sdr sdr; }; #endif