IS31SE5000 IR SENSOR FOR TOUCHLESS MOTION AND PROXIMITY

Dependents:   test_IS31SE5000 testSensor

Committer:
Rhyme
Date:
Thu Dec 24 00:40:19 2015 +0000
Revision:
0:b92d4b745118
Child:
1:3f4ccc809dfc
first commit before publishing;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:b92d4b745118 1 /**
Rhyme 0:b92d4b745118 2 * IR31SE5000 : IR sensor for touchless motion and proximity
Rhyme 0:b92d4b745118 3 * IS31SE5000.h
Rhyme 0:b92d4b745118 4 *
Rhyme 0:b92d4b745118 5 */
Rhyme 0:b92d4b745118 6
Rhyme 0:b92d4b745118 7 #ifndef _IS31SE5000_h_
Rhyme 0:b92d4b745118 8 #define _IS31SE5000_h_
Rhyme 0:b92d4b745118 9
Rhyme 0:b92d4b745118 10 class IS31SE5000
Rhyme 0:b92d4b745118 11 {
Rhyme 0:b92d4b745118 12 public:
Rhyme 0:b92d4b745118 13 /**
Rhyme 0:b92d4b745118 14 * constructor
Rhyme 0:b92d4b745118 15 *
Rhyme 0:b92d4b745118 16 * @param sda SDA pin
Rhyme 0:b92d4b745118 17 * @param scl SCL pin
Rhyme 0:b92d4b745118 18 * @param addr 7bit address of the I2C peripheral
Rhyme 0:b92d4b745118 19 */
Rhyme 0:b92d4b745118 20 IS31SE5000(PinName sda, PinName scl, int addr) ;
Rhyme 0:b92d4b745118 21
Rhyme 0:b92d4b745118 22 ~IS31SE5000() ;
Rhyme 0:b92d4b745118 23
Rhyme 0:b92d4b745118 24 /* for Status Register */
Rhyme 0:b92d4b745118 25 uint8_t getStatus(void) ; /* returns status register */
Rhyme 0:b92d4b745118 26 uint8_t getPD(void) ; /* get Proximity Detection Value */
Rhyme 0:b92d4b745118 27 uint8_t getMD(void) ; /* get Motion Detection Value */
Rhyme 0:b92d4b745118 28
Rhyme 0:b92d4b745118 29 /* for Shutdown Register */
Rhyme 0:b92d4b745118 30 void activate(void) ;
Rhyme 0:b92d4b745118 31 void shutdown(void) ;
Rhyme 0:b92d4b745118 32
Rhyme 0:b92d4b745118 33 /* for Configuration Register */
Rhyme 0:b92d4b745118 34 void setEC(uint8_t ec_value) ;
Rhyme 0:b92d4b745118 35 void motionMode(void) ;
Rhyme 0:b92d4b745118 36 void proximityMode(void) ;
Rhyme 0:b92d4b745118 37 uint8_t getEC(void) ;
Rhyme 0:b92d4b745118 38 uint8_t getMode(void) ;
Rhyme 0:b92d4b745118 39
Rhyme 0:b92d4b745118 40 /* */
Rhyme 0:b92d4b745118 41 uint8_t get_shutdown_reg(void) ;
Rhyme 0:b92d4b745118 42 uint8_t get_config_reg(void) ;
Rhyme 0:b92d4b745118 43
Rhyme 0:b92d4b745118 44 /*
Rhyme 0:b92d4b745118 45 * some member functions here (yet to be written)
Rhyme 0:b92d4b745118 46 */
Rhyme 0:b92d4b745118 47 private:
Rhyme 0:b92d4b745118 48 I2C m_i2c;
Rhyme 0:b92d4b745118 49 int m_addr;
Rhyme 0:b92d4b745118 50 void readRegs(int addr, uint8_t *data, int len) ;
Rhyme 0:b92d4b745118 51 void writeRegs(uint8_t *data, int len) ;
Rhyme 0:b92d4b745118 52
Rhyme 0:b92d4b745118 53 uint8_t shutdown_reg ;
Rhyme 0:b92d4b745118 54 uint8_t config_reg ;
Rhyme 0:b92d4b745118 55 } ;
Rhyme 0:b92d4b745118 56
Rhyme 0:b92d4b745118 57 #endif /* _IS31SE5000_h_ */