Modified for compatibility with Rev.E. hardware

Fork of AkmSensor by AKM Development Platform

ak09970ctrl.h

Committer:
masahikofukasawa
Date:
2017-03-17
Revision:
29:b488d2c89fba
Parent:
27:41aa9fb23a2f
Child:
34:1ea3357c8d9a

File content as of revision 29:b488d2c89fba:

#ifndef AK09970CTRL_H
#define AK09970CTRL_H

#include "mbed.h"
#include "SerialNano.h"
#include "akmsensor.h"
#include "ak09970.h"

class Ak09970Ctrl : public AkmSensor
{

public:
    
    typedef AkmSensor base;

    // 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 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);
    virtual void setEvent();
    
private:
    AK09970*        ak09970;
//    InterruptIn*    interrupt;

    // hold settings for AK09970
    AK09970::Threshold threshold;
    AK09970::OperationMode mode;
    AK09970::SensorDriveMode sensorDriveMode;
    AK09970::SensorMeasurementRange sensorMeasurementRange;
    AK09970::ReadConfig readConfig;
    AK09970::SwitchConfig switchConfig;
};

#endif