Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
Diff: akmakd.h
- Revision:
- 34:1ea3357c8d9a
- Parent:
- 29:b488d2c89fba
- Parent:
- 24:1d37438f31a9
- Child:
- 38:e865dadfe54d
--- a/akmakd.h Fri Apr 28 20:32:31 2017 +0000 +++ b/akmakd.h Wed May 03 18:00:45 2017 +0000 @@ -9,6 +9,13 @@ #define AKDP_MAG_SENSITIVITY (0.15) // [uT/LSB] #define AKDP_POLLING_FREQUENCY (200.0) // [Hz] +/** + * Collection class for handling commands to all of the specialty AKM + * daughter board adapter modules. + * + * 3-Axis Electronic Compass Devices: AK8963C, AK8963N, AK09911C, AK09912C, + * AK09915C, AK09915D, AK09916C, AK09916D, AK09970 + */ class AkmAkd : public AkmSensor { @@ -16,17 +23,19 @@ 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 + /** + * List of daughter board adapter devices (5-bit Sub-IDs). Primary ID = 0Fh + */ + typedef enum { + SUB_ID_AK8963N = 0x1A, /**< AK8963N: ID = 1Ah (26) */ + SUB_ID_AK8963C = 0x1C, /**< AK8963C: ID = 1Ch (28) */ + SUB_ID_AK09911C = 0x0A, /**< AK09911C: ID = 0Ah (10) */ + SUB_ID_AK09912C = 0x09, /**< AK09912C: ID = 09h (9) */ + SUB_ID_AK09915C = 0x0D, /**< AK09915C: ID = 0Dh (13) */ + SUB_ID_AK09916C = 0x0E, /**< AK09916C: ID = 0Eh (14) */ + SUB_ID_AK09916D = 0x0F, /**< AK09916D: ID = 0Fh (15) */ + SUB_ID_AK09915D = 0x10, /**< AK09915D: ID = 10h (16) */ + SUB_ID_AK09918 = 0x11, /**< AK09918: ID = 11h (17) */ } SubIdAkd; typedef enum { @@ -46,14 +55,60 @@ * */ virtual ~AkmAkd(); + + /** + * Process for intializing the selected sensor. + * + * @return Termination status type for debugging purposes. + */ virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid); + + /** + * Process abstraction for starting sensor operation. + * + * @return Termination status type for debugging purposes. + */ virtual AkmSensor::Status startSensor(); + + /** + * Process abstraction for starting sensor operation. + * + * @param sec Number of seconds of operation. + * @return Termination status type for debugging purposes. + */ virtual AkmSensor::Status startSensor(const float sec); + + /** + * Process abstraction for stopping sensor operation. + * + * @return Termination status type for debugging purposes. + */ virtual AkmSensor::Status stopSensor(); + + /** + * Process abstraction for reading data from the sensor. + * + * @param msg Message object that will hold the sensor data. + * @return Termination status type for debugging purposes. + */ virtual AkmSensor::Status readSensorData(Message* msg); + + /** + * Primary process for interfacing a sensor with the AKDP. When implemented + * in sensor class, it will transfer commands between the the sensor control + * class and AkmSensorManager. + * + * @param in Command message to be processed by sensor. + * @param out Message returned from sensor. + * @return Termination status type for debugging purposes. + */ virtual Status requestCommand(Message* in, Message* out); + + /** + * Set event flag. + */ 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);