CN0396 (4-Wire Electrochemical Dual Toxic Gas Sensing System)

Dependencies:   AD5270 AD7798 ADT7310

Dependents:   cn0396-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:51:15 2016 +0000
Parent:
1:024253f170c3
Commit message:
Fix for mbed online compiler (array initialization not allowed within class declaration)

Changed in this revision

CN0396.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 024253f170c3 -r 8d2d32e76157 CN0396.cpp
--- a/CN0396.cpp	Mon Nov 07 16:22:55 2016 +0000
+++ b/CN0396.cpp	Tue Nov 08 09:51:15 2016 +0000
@@ -20,10 +20,8 @@
 
 extern Serial pc;
 
-CN0396::CN0396(PinName csad, PinName csrdac, PinName cstemp) :
-    csad(csad), csrdac(csrdac), cstemp(cstemp), ad(csad), rdac(csrdac), temp(cstemp)
-{
-ppm_compensation_t ppm_compensation[COMPENSATION_TABLE_SIZE] = {
+
+CN0396::ppm_compensation_t ppm_compensation_init[COMPENSATION_TABLE_SIZE]  = {
         { -30	, 29.9  , 82.3 },
         { -20	, 38.8  , 84.6 },
         { -10	, 53.7  , 88.6 },
@@ -34,6 +32,10 @@
         {40		, 123.7 , 105.6},
         {50		, 133.1 , 107.4}
     };
+CN0396::CN0396(PinName csad, PinName csrdac, PinName cstemp) :
+    csad(csad), csrdac(csrdac), cstemp(cstemp), ad(csad), rdac(csrdac), temp(cstemp)
+{
+memcpy(ppm_compensation,ppm_compensation_init,COMPENSATION_TABLE_SIZE*sizeof(ppm_compensation_t));
 }
 
 void CN0396::data_to_voltage(uint16_t adcValue, float *voltage, int gain_adc)