MSS / MAX44000

Dependents:   test_MAX44000 testSensor PMK2022_Agriculture

Revision:
0:c9c9e362ec57
Child:
1:e3d11ab4c524
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MAX44000.h	Tue Dec 15 01:15:52 2015 +0000
@@ -0,0 +1,64 @@
+/**
+ * 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) ;
+void getMainConfig(uint8_t *conf) ;
+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_ */