Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of AkmSensor by
Diff: akmakd.h
- Revision:
- 23:50c98b286e41
- Parent:
- 13:d008249f0359
- Child:
- 24:1d37438f31a9
diff -r f44f1018081e -r 50c98b286e41 akmakd.h
--- a/akmakd.h Mon Apr 10 23:02:52 2017 +0000
+++ b/akmakd.h Thu Apr 13 22:15:54 2017 +0000
@@ -6,21 +6,30 @@
#include "akmsensor.h"
#include "akmecompass.h"
+/**
+ * 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
{
public:
- // SUB ID
- typedef enum { // 5bit 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
+ /**
+ * 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) */
} SubIdAkd;
/**
@@ -34,17 +43,81 @@
*
*/
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);
+
+ /**
+ * Simple flag process to determine if an event has occurred.
+ *
+ * @return TRUE if event has occurred, FALSE if not.
+ */
virtual bool isEvent();
+
+ /**
+ * 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);
+
+ /**
+ * Get the name of the sensor in char format.
+ *
+ * @return Sensor name as a char array.
+ */
virtual char* getSensorName();
+ /**
+ * Checks if data is ready or if there is a data overrun and store the
+ * status in 'event'.
+ */
void checkDRDY();
+ /**
+ * Forces a data ready state by setting 'event' to TRUE.
+ */
void detectDRDY();
+ /**
+ * For AK8963, returns the type of sensor.
+ */
int getSensorType();
private:

