Mark Underwood / MaximTinyTester

Dependents:   MAX5715BOB_Tester MAX11131BOB_Tester MAX5171BOB_Tester MAX11410BOB_Tester ... more

Files at this revision

API Documentation at this revision

Comitter:
whismanoid
Date:
Wed Jul 10 21:42:07 2019 +0000
Parent:
2:9b20cadbfa15
Child:
4:63d97c7be309
Commit message:
Support Nucleo_F446RE (LED indicators are NC)

Changed in this revision

MaximTinyTester.cpp Show annotated file Show diff for this revision Revisions of this file
MaximTinyTester.h Show annotated file Show diff for this revision Revisions of this file
diff -r 9b20cadbfa15 -r 080aa1bb1bc0 MaximTinyTester.cpp
--- a/MaximTinyTester.cpp	Wed Jul 10 11:01:58 2019 +0000
+++ b/MaximTinyTester.cpp	Wed Jul 10 21:42:07 2019 +0000
@@ -36,6 +36,13 @@
 
 #include "MaximTinyTester.h"
 
+#ifndef LED_ON
+# define LED_ON  0
+#endif
+#ifndef LED_OFF
+# define LED_OFF 1
+#endif
+
 MaximTinyTester::MaximTinyTester(CmdLine& AssociatedCmdLine,
     AnalogIn& analogInPin0,
     AnalogIn& analogInPin1,
@@ -80,7 +87,16 @@
 {
     nPass = 0;
     nFail = 0;
-    m_RFailLED = LED_ON; m_GPassLED = LED_ON; m_BBusyLED = LED_OFF;
+    // PinName NC means NOT_CONNECTED; DigitalOut::is_connected() returns false
+    if (m_RFailLED.is_connected()) {
+        m_RFailLED = LED_ON;
+    }
+    if (m_GPassLED.is_connected()) {
+        m_GPassLED = LED_ON;
+    }
+    if (m_BBusyLED.is_connected()) {
+        m_BBusyLED = LED_OFF;
+    }
 }
 
 /** report that a test has completed with success.
@@ -93,9 +109,19 @@
     ++nPass;
     // m_RFailLED = LED_ON; m_GPassLED = LED_ON; m_BBusyLED = LED_ON;
     // pulse blue LED during test to indicate activity
-    m_GPassLED = LED_OFF; m_BBusyLED = LED_ON;
+    if (m_GPassLED.is_connected()) {
+        m_GPassLED = LED_OFF;
+    }
+    if (m_BBusyLED.is_connected()) {
+        m_BBusyLED = LED_ON;
+    }
     wait_ms(blink_time_msec); // delay
-    m_GPassLED = LED_ON; m_BBusyLED = LED_OFF;
+    if (m_GPassLED.is_connected()) {
+        m_GPassLED = LED_ON;
+    }
+    if (m_BBusyLED.is_connected()) {
+        m_BBusyLED = LED_OFF;
+    }
     wait_ms(blink_time_msec); // delay
     associatedCmdLine.serial().printf("\r\n+PASS ");
 }
@@ -110,9 +136,19 @@
     ++nFail;
     // m_RFailLED = LED_ON; m_GPassLED = LED_ON; m_BBusyLED = LED_ON;
     // pulse blue LED during test to indicate activity
-    m_RFailLED = LED_OFF; m_BBusyLED = LED_ON;
+    if (m_RFailLED.is_connected()) {
+        m_RFailLED = LED_OFF;
+    }
+    if (m_BBusyLED.is_connected()) {
+        m_BBusyLED = LED_ON;
+    }
     wait_ms(blink_time_msec); // delay
-    m_RFailLED = LED_ON; m_BBusyLED = LED_OFF;
+    if (m_RFailLED.is_connected()) {
+        m_RFailLED = LED_ON;
+    }
+    if (m_BBusyLED.is_connected()) {
+        m_BBusyLED = LED_OFF;
+    }
     wait_ms(blink_time_msec); // delay
     associatedCmdLine.serial().printf("\r\n-FAIL ");
 #if USE_LEDS
@@ -137,11 +173,27 @@
     //~ associatedCmdLine.serial().printf(g_SelfTest_nFail);
     //~ associatedCmdLine.serial().printf(" FAIL\r\n");
     if (nFail == 0) {
-        m_RFailLED = LED_OFF; m_GPassLED = LED_ON; m_BBusyLED = LED_OFF;
+        if (m_RFailLED.is_connected()) {
+            m_RFailLED = LED_OFF;
+        }
+        if (m_GPassLED.is_connected()) {
+            m_GPassLED = LED_ON;
+        }
+        if (m_BBusyLED.is_connected()) {
+            m_BBusyLED = LED_OFF;
+        }
         //~ rgb_led.green();     // diagnostic rbg led GREEN
     }
     else {
-        m_RFailLED = LED_ON; m_GPassLED = LED_OFF; m_BBusyLED = LED_OFF;
+        if (m_RFailLED.is_connected()) {
+            m_RFailLED = LED_ON;
+        }
+        if (m_GPassLED.is_connected()) {
+            m_GPassLED = LED_OFF;
+        }
+        if (m_BBusyLED.is_connected()) {
+            m_BBusyLED = LED_OFF;
+        }
         //~ rgb_led.red(); // diagnostic rbg led RED
     }
 }
diff -r 9b20cadbfa15 -r 080aa1bb1bc0 MaximTinyTester.h
--- a/MaximTinyTester.h	Wed Jul 10 11:01:58 2019 +0000
+++ b/MaximTinyTester.h	Wed Jul 10 21:42:07 2019 +0000
@@ -51,6 +51,20 @@
     CmdLine& associatedCmdLine;
 
 public:
+    /** Constructor for MaximTinyTester class.
+    *
+    * @param[in] AssociatedCmdLine = reference to serial CmdLine
+    * @param[in] analogInPin0 = port for analog input measurement
+    * @param[in] analogInPin1 = port for analog input measurement
+    * @param[in] analogInPin2 = port for analog input measurement
+    * @param[in] analogInPin3 = port for analog input measurement
+    * @param[in] analogInPin4 = port for analog input measurement
+    * @param[in] analogInPin5 = port for analog input measurement
+    * @param[in] m_RFailLED = port for red LED; use NC if not connected
+    * @param[in] m_GPassLED = port for green LED; use NC if not connected
+    * @param[in] m_BBusyLED = port for blue LED; use NC if not connected
+    *
+    */
     MaximTinyTester(CmdLine& AssociatedCmdLine,
         AnalogIn& analogInPin0,
         AnalogIn& analogInPin1,