Generates a test signal on an AnalogOut and monitors a signal on an AnalogIn, plotting the test signal or the actual signal depending on a conditional compile. The wait() and wait_ms() library calls for this board are highly inaccurate so a new function is provided to wait for X number of milliseconds -- which is not very accurate.

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI mbed-os BSP_DISCO_F429ZI

Revision:
1:b9d4b9b8884c
Parent:
0:1ebe7d222470
Child:
2:cbcf2695a4a1
--- a/LaserMon-Main.cpp	Mon Jun 10 17:10:01 2019 +0000
+++ b/LaserMon-Main.cpp	Fri Jun 14 21:11:31 2019 +0000
@@ -74,37 +74,12 @@
     // Go in to a forever loop for the main thread which does nothing
     while(true)
     {
-        // Wait for 1 second and then wait again
-        wait(1.0);
+        // Wait for 1 millisecond
+        wait_us(899);
+        TestOutputThread();
+        ScanInputThread();
     }
 }
 
-// ----------------------------------------------------------------------
-// accurate_wait_ms()
-//
-// Because the wait() and wait_ms() library calls for the board we are
-// using is not accurate, this function is provided which uses
-// microseconds to scale the requested wait offered in milliseconds.
-//
-// ----------------------------------------------------------------------
-void accurate_wait_ms(uint16_t u16_thisManyMilliseconds)
-{
-    // There are one million microseconds in a second
-    // There are one thousand milliseconds in a second
-    // Compute how many microseconds would normally be needed to
-    // perform the reqested number of milliseconds to wait if the
-    // system clock / crystal were accurate
-    uint64_t u64_thisManyMicroseconds = (u16_thisManyMilliseconds * 100000);
-    
-    // Since the clock appears to run much faster than expected by 
-    // the mbed library, divide the number of microseconds by a
-    // hard-coded scaling factor to attempt to yield a number that
-    // is closer to what we actually get
-    u64_thisManyMicroseconds /= 300ul;
-    
-    // Now wait that many microseconds asking the library to do it
-    wait_us((int)u64_thisManyMicroseconds);
-}
-
 // End of file