Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
akmanalogsensor.h
- Committer:
- masahikofukasawa
- Date:
- 2017-03-17
- Revision:
- 29:b488d2c89fba
- Parent:
- 27:41aa9fb23a2f
- Child:
- 34:1ea3357c8d9a
File content as of revision 29:b488d2c89fba:
#ifndef AKMANALOGSENSOR_H #define AKMANALOGSENSOR_H #include "mbed.h" #include "SerialNano.h" #include "akmsensor.h" #include "mcp342x.h" class AkmAnalogSensor : public AkmSensor { public: typedef AkmSensor base; 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, } SubIdCurrentSensor; typedef enum { SUB_ID_EM3242 = 0x01, SUB_ID_AK9710 = 0x08, } SubIdMisc; typedef enum { SUB_ID_EQ430L = 0x01, SUB_ID_EQ431L = 0x02, SUB_ID_EQ432L = 0x03, SUB_ID_EQ433L = 0x04, } SubIdLinearSensor; /** * Constructor. * */ AkmAnalogSensor(); /** * Destructor. * */ virtual ~AkmAnalogSensor(); 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 Status requestCommand(Message* in, Message* out); private: Ticker ticker; AnalogIn* ain; MCP342X* mcp3428; float interval; }; #endif