Program to update the D7A modem's firmware.

Dependencies:   modem_ref_helper DebouncedInterrupt

Revision:
32:e3ee65b5b835
Parent:
29:aa16a927f0eb
Child:
33:9cd782e2b423
--- a/main.cpp	Fri Feb 22 16:35:52 2019 +0000
+++ b/main.cpp	Tue Aug 20 13:51:30 2019 +0000
@@ -132,6 +132,8 @@
           "-----------------------------------------\r\n"
           "------------- D7A WM Updater ------------\r\n"
           "-----------------------------------------\r\n");
+          
+    PRINT("SystemCoreClock is %d Hz\r\n", SystemCoreClock);  
 
 #ifdef DEBUG_BUTTON
     DebouncedInterrupt user_interrupt(DEBUG_BUTTON);
@@ -146,7 +148,7 @@
     {
         // Check modem revision
         modem_read_file(D7A_FID_FIRMWARE_VERSION, &rev, 0, sizeof(revision_t), g_main_id);
-        modem_ready.wait();
+        modem_ready.acquire();
         
         if (check_parameter("Manufacturer ID...       ", rev.manufacturer_id, cup->mfg_id))
         {
@@ -263,14 +265,14 @@
                         cup->fw_major, cup->fw_minor, cup->fw_patch);
 #ifdef DEBUG_BUTTON
                 PRINT("PRESS USER BUTTON TO CONFIRM...\r\n");
-                button_user.wait();
+                button_user.acquire();
 #endif
                 PRINT("\r\nDowngrading firmware: v%d.%d.%d --> v%d.%d.%d\r\n", 
                         rev.fw_version.major, rev.fw_version.minor, rev.fw_version.patch,
                         cup->fw_major, cup->fw_minor, cup->fw_patch);
 #ifdef DEBUG_BUTTON
                 PRINT("PRESS USER BUTTON TO START DOWNGRADE...\r\n");
-                button_user.wait();
+                button_user.acquire();
 #endif
             }
             else if (version_old != version_new)
@@ -280,7 +282,7 @@
                         cup->fw_major, cup->fw_minor, cup->fw_patch);
 #ifdef DEBUG_BUTTON
                 PRINT("PRESS USER BUTTON TO START UPGRADE...\r\n");
-                button_user.wait();
+                button_user.acquire();
 #endif
             }
             else
@@ -290,7 +292,7 @@
                         rev.fw_version.major, rev.fw_version.minor, rev.fw_version.patch,
                         cup->fw_major, cup->fw_minor, cup->fw_patch);
                 PRINT("PRESS USER BUTTON TO START RESET...\r\n");
-                button_user.wait();
+                button_user.acquire();
 #else
                 // No button to stop code
                 break;
@@ -303,10 +305,10 @@
     } while (0);
     
     // Set main task to lowest priority
-    osThreadSetPriority(osThreadGetId(), osPriorityIdle);
+    osThreadSetPriority(osThreadGetId(), osPriorityLow);
     while(true)
     {
         // Wait to avoid beeing stuck in loop
-        Thread::wait(200);
+        ThisThread::sleep_for(200);
     }
 }