Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
Diff: akmanalogsensor.h
- Revision:
- 11:cef8dc1cf010
- Child:
- 13:d008249f0359
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/akmanalogsensor.h Fri Jul 22 22:54:11 2016 +0000 @@ -0,0 +1,51 @@ +#ifndef AKMANALOGSENSOR_H +#define AKMANALOGSENSOR_H + +#include "mbed.h" +#include "SerialNano.h" +#include "akmsensor.h" +#include "mcp342x.h" + +class AkmAnalogSensor : public AkmSensor +{ + +public: + typedef enum { + SUB_ID_EQ430L = 0x00, + SUB_ID_EQ431L = 0x01, + SUB_ID_EQ432L = 0x02, + SUB_ID_EQ433L = 0x03, + } SubIdLinearSensor; + + /** + * Constructor. + * + */ + AkmAnalogSensor(); + + /** + * Destructor. + * + */ + virtual ~AkmAnalogSensor(); + 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 Status requestCommand(Message* in, Message* out); + void eventCallback(); + +private: + bool event; + uint8_t primaryId; + uint8_t subId; + + Ticker ticker; + AnalogIn* ain; + MCP342X* mcp3428; + float interval; +}; + +#endif