Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
Diff: akmhallswitch.h
- Revision:
- 0:7a00359e701e
- Child:
- 6:c4401549d68f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/akmhallswitch.h Thu Apr 28 21:12:04 2016 +0000 @@ -0,0 +1,81 @@ +#ifndef AKMHALLSWITCH_H +#define AKMHALLSWITCH_H + +#include "mbed.h" +#include "SerialNano.h" +#include "akmsensor.h" + +class AkmHallSwitch : public AkmSensor +{ + +public: + + typedef enum { + SUB_ID_EM1771 = 0x00, + SUB_ID_EW453 = 0x03, + SUB_ID_EW653B = 0x0C, + SUB_ID_EW6672 = 0x0D, + } SubIdUnipolarSwitch; + + typedef enum { + SUB_ID_EM1781 = 0x00, + SUB_ID_AK8788A = 0x03, + SUB_ID_EM6781 = 0x0C, + } SubIdOmnipolarSwitch; + + typedef enum { + SUB_ID_AK8771 = 0x00, + SUB_ID_EZ470 = 0x03, + SUB_ID_EZ471 = 0x04, + SUB_ID_EW432 = 0x08, + SUB_ID_EW612B = 0x0C, + SUB_ID_EW632 = 0x0D, + } SubIdBipolarLatch; + + typedef enum { + SUB_ID_AK8789 = 0x03, + SUB_ID_EM1791 = 0x04, + } SubIdDualSwitch; + + typedef enum { + SUB_ID_AK8776 = 0x00, + SUB_ID_AK8775 = 0x01, + SUB_ID_AK8779A = 0x0B, + SUB_ID_AK8779B = 0x0C, + } SubIdOnechipEncoder; + + /** + * Constructor. + * + */ + AkmHallSwitch(); + + /** + * Destructor. + * + */ + virtual ~AkmHallSwitch(); + 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 riseEventD0(); + void fallEventD0(); + void riseEventD1(); + void fallEventD1(); + +private: + bool event; + uint8_t primaryId; + uint8_t subId; + + uint8_t d0; + uint8_t d1; + InterruptIn* sw0; + InterruptIn* sw1; +}; + +#endif