CN0397 (Smart Visible Light Detection)

Dependencies:   AD7798

Dependents:   cn0397-helloworld

For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all

Files at this revision

API Documentation at this revision

Comitter:
adisuciu
Date:
Tue Nov 08 09:56:25 2016 +0000
Parent:
0:61b289f9bab0
Commit message:
Fixed for mbed online compiler (array initialization not allowed within class declaration)

Changed in this revision

AD7798.lib Show annotated file Show diff for this revision Revisions of this file
CN0397.cpp Show annotated file Show diff for this revision Revisions of this file
CN0397.h Show annotated file Show diff for this revision Revisions of this file
diff -r 61b289f9bab0 -r 77eb0888c15a AD7798.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AD7798.lib	Tue Nov 08 09:56:25 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/AnalogDevices/code/AD7798/#fb6fe6fa2835
diff -r 61b289f9bab0 -r 77eb0888c15a CN0397.cpp
--- a/CN0397.cpp	Mon Nov 07 15:57:44 2016 +0000
+++ b/CN0397.cpp	Tue Nov 08 09:56:25 2016 +0000
@@ -61,10 +61,15 @@
     while (pc.readable())  pc.getc();
 }
 
+const uint8_t CN0397::Channels[3] = { 1, 0, 2};
+const char CN0397::colour[3][6] = { "RED", "GREEN", "BLUE" };
+const uint8_t CN0397::ColorPrint[3] = { 31, 32, 34 };
+const uint8_t CN0397::Gain[8] = { 1, 2, 4, 8, 16, 32, 64, 128};
+const float CN0397::Lux_LSB[3] = {2.122, 2.124, 2.113};
+const float CN0397::Optimal_Levels[3] = {26909.0, 8880.0, 26909.0};
 
 CN0397::CN0397(PinName cs) : ad7798(cs)
-{
-
+{    
 }
 void CN0397::display_data(void)
 {
diff -r 61b289f9bab0 -r 77eb0888c15a CN0397.h
--- a/CN0397.h	Mon Nov 07 15:57:44 2016 +0000
+++ b/CN0397.h	Tue Nov 08 09:56:25 2016 +0000
@@ -157,16 +157,14 @@
     uint16_t modeReg, configReg, offsetReg, fullscaleReg, dataReg;
     uint16_t adcValue[3];
     float voltageValue[3], intensityValue[3], lightConcentration[3];
-    const uint8_t Channels[3] = { 1, 0, 2};
-    const char colour[3][6] = {
-        "RED", "GREEN", "BLUE",
-    };
-
-    const uint8_t ColorPrint[3] = { 31, 32, 34 };
-    const uint8_t Gain[8] = { 1, 2, 4, 8, 16, 32, 64, 128};
-    const float Lux_LSB[3] = {2.122, 2.124, 2.113};
-    const float Optimal_Levels[3] = {26909.0, 8880.0, 26909.0};
-
+    
+    static const uint8_t Channels[3];
+    static const char colour[3][6];
+    static const uint8_t ColorPrint[3];
+    static const uint8_t Gain[8];
+    static const float Lux_LSB[3];
+    static const float Optimal_Levels[3];
+    
 };
 
 #endif /* CN0397_H_ */