IS31SE5000 IR SENSOR FOR TOUCHLESS MOTION AND PROXIMITY
Dependents: test_IS31SE5000 testSensor
Diff: IS31SE5000.h
- Revision:
- 0:b92d4b745118
- Child:
- 1:3f4ccc809dfc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IS31SE5000.h Thu Dec 24 00:40:19 2015 +0000 @@ -0,0 +1,57 @@ +/** + * IR31SE5000 : IR sensor for touchless motion and proximity + * IS31SE5000.h + * + */ + +#ifndef _IS31SE5000_h_ +#define _IS31SE5000_h_ + +class IS31SE5000 +{ +public: + /** + * constructor + * + * @param sda SDA pin + * @param scl SCL pin + * @param addr 7bit address of the I2C peripheral + */ + IS31SE5000(PinName sda, PinName scl, int addr) ; + + ~IS31SE5000() ; + + /* for Status Register */ + uint8_t getStatus(void) ; /* returns status register */ + uint8_t getPD(void) ; /* get Proximity Detection Value */ + uint8_t getMD(void) ; /* get Motion Detection Value */ + + /* for Shutdown Register */ + void activate(void) ; + void shutdown(void) ; + + /* for Configuration Register */ + void setEC(uint8_t ec_value) ; + void motionMode(void) ; + void proximityMode(void) ; + uint8_t getEC(void) ; + uint8_t getMode(void) ; + + /* */ + uint8_t get_shutdown_reg(void) ; + uint8_t get_config_reg(void) ; + + /* + * some member functions here (yet to be written) + */ + private: + I2C m_i2c; + int m_addr; + void readRegs(int addr, uint8_t *data, int len) ; + void writeRegs(uint8_t *data, int len) ; + + uint8_t shutdown_reg ; + uint8_t config_reg ; +} ; + +#endif /* _IS31SE5000_h_ */ \ No newline at end of file