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: akmanalogsensor.h
- Revision:
- 23:50c98b286e41
- Parent:
- 13:d008249f0359
- Child:
- 34:1ea3357c8d9a
--- a/akmanalogsensor.h Mon Apr 10 23:02:52 2017 +0000
+++ b/akmanalogsensor.h Thu Apr 13 22:15:54 2017 +0000
@@ -6,33 +6,57 @@
#include "akmsensor.h"
#include "mcp342x.h"
+/**
+ * Collection class for handling commands to all AKM Analog Sensor modules.
+ *
+ * List of Devices:
+ *
+ * Current Sensors: CQ3300, CQ3301, CQ3302, CQ3303, CQ330A, CQ330B, CQ330E,
+ * CQ330F, CQ330G, CQ330H
+ *
+ * Linear Sensors: EQ430L, EQ431L, EQ432L, EQ433L
+ *
+ * Angle Sensors: EM3242
+ *
+ * IR/CO2 Sensor: AK9710
+ */
class AkmAnalogSensor : public AkmSensor
{
public:
+
+ /**
+ * Sub-IDs for current sensor devices. Primary ID = 09h
+ */
typedef enum {
- SUB_ID_CQ3300 = 0x01,
- SUB_ID_CQ3301 = 0x02,
- SUB_ID_CQ3302 = 0x03,
- SUB_ID_CQ3303 = 0x04,
- SUB_ID_CQ330A = 0x05,
- SUB_ID_CQ330B = 0x06,
- SUB_ID_CQ330E = 0x07,
- SUB_ID_CQ330F = 0x08,
- SUB_ID_CQ330G = 0x09,
- SUB_ID_CQ330H = 0x0A,
+ SUB_ID_CQ3300 = 0x01, /**< CQ3300: ID = 01h */
+ SUB_ID_CQ3301 = 0x02, /**< CQ3301: ID = 02h */
+ SUB_ID_CQ3302 = 0x03, /**< CQ3302: ID = 03h */
+ SUB_ID_CQ3303 = 0x04, /**< CQ3303: ID = 04h */
+ SUB_ID_CQ330A = 0x05, /**< CQ330A: ID = 05h */
+ SUB_ID_CQ330B = 0x06, /**< CQ330B: ID = 06h */
+ SUB_ID_CQ330E = 0x07, /**< CQ330E: ID = 07h */
+ SUB_ID_CQ330F = 0x08, /**< CQ330F: ID = 08h */
+ SUB_ID_CQ330G = 0x09, /**< CQ330G: ID = 09h */
+ SUB_ID_CQ330H = 0x0A, /**< CQ330H: ID = 0Ah */
} SubIdCurrentSensor;
+ /**
+ * Sub-IDs for miscellaneous devices. Primary ID = 0Ah
+ */
typedef enum {
- SUB_ID_EM3242 = 0x01,
- SUB_ID_AK9710 = 0x08,
+ SUB_ID_EM3242 = 0x01, /**< EM3242: ID = 01h */
+ SUB_ID_AK9710 = 0x08, /**< AK9710: ID = 08h */
} SubIdMisc;
+ /**
+ * Sub-IDs for analog devices. Primary ID = 0Bh
+ */
typedef enum {
- SUB_ID_EQ430L = 0x01,
- SUB_ID_EQ431L = 0x02,
- SUB_ID_EQ432L = 0x03,
- SUB_ID_EQ433L = 0x04,
+ SUB_ID_EQ430L = 0x01, /**< EQ430L: ID = 01h */
+ SUB_ID_EQ431L = 0x02, /**< EQ */
+ SUB_ID_EQ432L = 0x03, /**< */
+ SUB_ID_EQ433L = 0x04, /**< */
} SubIdLinearSensor;
/**
@@ -46,15 +70,72 @@
*
*/
virtual ~AkmAnalogSensor();
+
+ /**
+ * 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();
+ /**
+ * Callback function for event handling.
+ */
void eventCallback();
private:

