smart sensor code initial version

Dependencies:   mbed-src-KL05Z-smart-sensor

Revision:
4:a2f83fac24bc
Parent:
3:d908dc9882d2
--- a/kl05-smart-sensor.cpp	Tue Mar 26 10:50:33 2019 +0000
+++ b/kl05-smart-sensor.cpp	Tue Mar 26 10:52:08 2019 +0000
@@ -252,7 +252,7 @@
     for (i = 0; i < nbMeas; i++){
         low1I += LOW1_ADC;
     }
-//VBrun6    if (!autorange) enableHighRange();
+//VBrun6+run7    if (!autorange) enableHighRange();
     low1I = factor_L1 * low1I/nbMeas;
     #if (USEI2CNOTUART == 0)
     timestamp = timer.read();
@@ -267,7 +267,7 @@
     for (i = 0; i < nbMeas; i++){
         low2I += LOW2_ADC;
     }
-//VBrun6    if (!autorange) enableHighRange();
+//VBrun6+run7    if (!autorange) enableHighRange();
     low2I = factor_L2 * low2I/nbMeas;
     #if (USEI2CNOTUART == 0)
     timestamp = timer.read();
@@ -283,7 +283,7 @@
 
 float measureAutoI(int nbMeas){
     float tempI;
-//VBrun5+run6    enableHighRange();  // this should already be the case, but do it anyway...
+//VBrun5+run6+run7    enableHighRange();  // this should already be the case, but do it anyway...
     #if (USEI2CNOTUART == 0)
     current[0] = 0;
     current[1] = 0;
@@ -296,15 +296,16 @@
     status = 1;
     // if current is below this threshold, use LOW1 to measure... 
     if (tempI < 0.060) {
-//VBrun5+run6        enableLow1Range();
+//VBrun5+run6+run7        enableLow1Range();
         tempI = measureLow1(false, nbMeas); // call function 
         #if (USEI2CNOTUART == 0)
         current[1] = tempI;
         #endif
         status = 2;
         // if current is below this threshold, use LOW2 to measure...
-        if (tempI < 0.0009){
-//VBrun5+run6            enableLow2Range();  // change FETs to enable LOW2 measurement...
+//VBrun7        if (tempI < 0.0009){
+        if (tempI < 0.0015){
+//VBrun5+run6+run7            enableLow2Range();  // change FETs to enable LOW2 measurement...
             tempI = measureLow2(false, nbMeas);
             #if (USEI2CNOTUART == 0)
             current[2] = tempI;