MAX44000 Ambient and Infrared Proximity Sensor
Dependents: test_MAX44000 testSensor PMK2022_Agriculture
MAX44000.h
- Committer:
- Rhyme
- Date:
- 2016-07-07
- Revision:
- 1:e3d11ab4c524
- Parent:
- 0:c9c9e362ec57
- Child:
- 2:93ed4e2fe7fd
File content as of revision 1:e3d11ab4c524:
/** * MAX44000 * Ambient and Infrared Proximity Sensor * I2C 7bit address: 0x4A * */ #ifndef _MAX44000_H_ #define _MAX44000_H_ #include "mbed.h" class MAX44000 { public: /** * constructor * * @param sda SDA pin * @param scl SCL pin * @param addr address of the I2C peripheral */ MAX44000(PinName sda, PinName scl, int addr) ; ~MAX44000() ; /* * some member functions here (yet to be written) */ void getIntStatus(uint8_t *data) ; /** * Get Main Configuration * * @param *conf uint8_t pointer to receive the 8bit register value. * * Bit[7:6] : (reserved) * Bit[5] : TRIM * 0: Use bytes written to TRIM_GAIN_GREEN[7:0] and TRIM_GAIN_IR[7:0] registers * to set the fine-trim gain of the green and IR gain channels. * 1: Use factory-programmed gains for green and IR channels. * Ignore bytes written to TRIM_GAIN_GEEN[7:0] and TRIM_GAIN_IR[7:0] registers. * Bit[4:2] : mode * 000: Shutdown : Analog circuits are shut down, but the digital register retains values. * 001: ALS G-IR : Standard ALS mode stores the difference between green and infrared channel readings. * Proximity channel operation and updates are disabled. * 010: ALS G : ALS green channel only. Proximity channel operation and updates are disabled. * 011: ALS IR : Infrared channel only. Proximity channel operation and updates are disabled. * 100: ALS/PROX : ALS and PROX are interleaved continuously. * 101: PROX Only : PROX only continuously. ALS channel operation and updates are disabled. * 110: (reserved) * 111: (reserved) * Bit[1] : PRXINTE * Bit[0] : ALSINTE */ void getMainConfig(uint8_t *conf) ; /** * Set Mein Configuration * * @param conf uint8_t to specify the 8bit register value. * For the meanings of each bits, please refer to setMainConfig() description. */ void setMainConfig(uint8_t newConf) ; void getRxConfig(uint8_t *conf) ; void setRxConfig(uint8_t newConf) ; void getTxConfig(uint8_t *conf) ; void setTxConfig(uint8_t newConf) ; void getALS(uint8_t *ofl, uint16_t *value) ; void getProx(uint8_t *value) ; void getADC(uint8_t *ofl, uint16_t *als, uint8_t *prox) ; void getUPTHR(uint16_t *thr) ; void setUPTHR(uint16_t newThr) ; void getLOTHR(uint16_t *thr) ; void setLOTHR(uint16_t newThr) ; void getTHRPT(uint8_t *data) ; void setTHRPT(uint8_t newData) ; void getPRXTHR_IND(uint8_t *value) ; void setPRXTHR_IND(uint8_t newValue) ; void getPRX_THR(uint8_t *data) ; void setPRX_THR(uint8_t newValue) ; void getTRM_GAING(uint8_t *data) ; void setTRM_GAING(uint8_t newValue) ; void getTRM_GAINIR(uint8_t *data) ; void setTRM_GAINIR(uint8_t newValue) ; private: I2C m_i2c; int m_addr; void readRegs(int addr, uint8_t *data, int len) ; void writeRegs(uint8_t *data, int len) ; } ; #endif /* _MAX44000_H_ */