Modified for compatibility with Rev.E. hardware

Fork of AkmSensor by AKM Development Platform

Revision:
10:5c69b067d88a
Child:
13:d008249f0359
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ak09970ctrl.h	Fri Jul 08 22:26:26 2016 +0000
@@ -0,0 +1,61 @@
+#ifndef AK09970CTRL_H
+#define AK09970CTRL_H
+
+#include "mbed.h"
+#include "SerialNano.h"
+#include "akmsensor.h"
+#include "ak09970.h"
+
+class Ak09970Ctrl : public AkmSensor
+{
+
+public:
+
+    // SUB ID
+    typedef enum {                           // 5bit ID
+        SUB_ID_AK09970              = 0x03,  // 3
+    } SubIdSwitch;
+    
+    /**
+     * Constructor.
+     *
+     */
+    Ak09970Ctrl();
+
+    /**
+     * Destructor.
+     *
+     */
+    virtual ~Ak09970Ctrl();
+    virtual AkmSensor::Status init(const uint8_t id, const uint8_t subid);
+    virtual bool isEvent();
+    virtual AkmSensor::Status startSensor();
+    virtual AkmSensor::Status startSensor(const float sec);
+    virtual AkmSensor::Status stopSensor();
+    virtual AkmSensor::Status readSensorData(Message* msg);
+    virtual AkmSensor::Status requestCommand(Message* in, Message* out);
+
+    void checkINT();
+    void detectINT();
+    char* getSensorName();
+    
+private:
+    bool            event;    
+    uint8_t         primaryId;
+    uint8_t         subId;
+    AK09970*        ak09970;
+
+    // hold settings for AK09970
+    AK09970::Threshold threshold;
+    AK09970::OperationMode mode;
+    AK09970::SensorDriveMode sensorDriveMode;
+    AK09970::SensorMeasurementRange sensorMeasurementRange;
+    AK09970::ReadConfig readConfig;
+    AK09970::SwitchConfig switchConfig;
+
+    InterruptIn*    sw;    
+    char*           sensorName;
+};
+
+#endif
+