CM3592 simple library

Dependents:   Mt05_MtSense05

Revision:
0:a434d2ca0357
Child:
1:8547ec72dba2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CM3592.h	Tue Jun 06 01:56:14 2017 +0000
@@ -0,0 +1,34 @@
+#ifndef CM3592_H
+#define CM3592_H
+
+#define CM3592_ADDR                     0x20
+
+#define CM3592_REG_CTRL                 0x00
+#define CM3592_REG_ALS_HIGH_THRESHOLD   0x02
+#define CM3592_REG_ALS_LOW_THRESHOLD    0x03
+#define CM3592_REG_UV_DATA              0x04
+#define CM3592_REG_IR_DATA              0x05
+#define CM3592_REG_ALS_DATA             0x08
+#define CM3592_REG_WHITE_ALS_DATA       0x09
+#define CM3592_REG_DEVICE_ID            0x0C
+#define CM3592_REG_ALS_CROSS_INT_EVENT  0x0D
+
+#include "mbed.h"
+
+class CM3592 {
+    public:
+        CM3592(I2C& i2c);
+        int init();
+        int init(char configL, char configH);
+        int readData(uint16_t *uv);
+        int getUVIndex(uint16_t uv);
+    protected:
+        I2C m_i2c;
+        char config[2];
+        void write(char reg, char data[]);
+        void read(char reg, char data[]);
+    private:
+
+};
+
+#endif
\ No newline at end of file