Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
ak09970ctrl.h
- Committer:
- tkstreet
- Date:
- 2017-04-13
- Revision:
- 23:50c98b286e41
- Parent:
- 13:d008249f0359
- Child:
- 34:1ea3357c8d9a
File content as of revision 23:50c98b286e41:
#ifndef AK09970CTRL_H #define AK09970CTRL_H #include "mbed.h" #include "SerialNano.h" #include "akmsensor.h" #include "ak09970.h" /** * Class for handling commands issued to the AK09970. */ class Ak09970Ctrl : public AkmSensor { public: /** * Device Sub-ID (5-bit ID). */ typedef enum { SUB_ID_AK09970 = 0x03, /**< AK09970: ID = 03h */ } SubIdSwitch; /** * Constructor. * */ Ak09970Ctrl(); /** * Destructor. * */ virtual ~Ak09970Ctrl(); /** * 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(); /** * If data is ready or data overrun has occurred, the event flag is set. */ void checkINT(); /** * Causes the detecting of an interrupt by setting the event flag. */ void detectINT(); private: bool event; uint8_t primaryId; uint8_t subId; AK09970* ak09970; char* sensorName; // hold settings for AK09970 AK09970::Threshold threshold; AK09970::OperationMode mode; AK09970::SensorDriveMode sensorDriveMode; AK09970::SensorMeasurementRange sensorMeasurementRange; AK09970::ReadConfig readConfig; AK09970::SwitchConfig switchConfig; InterruptIn* sw; }; #endif