Helper library to use modem_ref driver.

Dependencies:   WizziCom WizziDebug ram_fs modem_ref

Dependents:   D7A_Localisation D7A_1x_demo_send_file_data_and_forget D7A_1x_demo_CodeUpgradeProtocol D7A_1x_demo_LoRaWAN ... more

Revision:
60:524b4f20d332
Parent:
58:f7105abdceed
Child:
61:8565bc7a6997
--- a/modem_ref_helper.cpp	Thu Aug 01 15:14:01 2019 +0000
+++ b/modem_ref_helper.cpp	Thu Aug 01 15:45:17 2019 +0000
@@ -235,7 +235,7 @@
     // Write the version to the version file.
     // This file is notified on write.
     modem_write_file_root(FID_HOST_REV, (void*)data, 0, HAL_U32_BYTE_SWAP(header->alloc), root_key, id);
-    g_modem_ready.try_acquire();
+    g_modem_ready.acquire();
     
     // Error when writing to the file
     if (ALP_ERR_NONE != g_err)
@@ -245,16 +245,16 @@
         {
             // Delete old file
             modem_delete_file_root(FID_HOST_REV, root_key, id);
-            g_modem_ready.try_acquire();
+            g_modem_ready.acquire();
         }
         
         // Recreate file
         modem_create_file(FID_HOST_REV, header, id);
-        g_modem_ready.try_acquire();
+        g_modem_ready.acquire();
         
         // Retry writing to the file
         modem_write_file_root(FID_HOST_REV, (void*)data, 0, HAL_U32_BYTE_SWAP(header->alloc), root_key, id);
-        g_modem_ready.try_acquire();
+        g_modem_ready.acquire();
     }
     
     modem_free_id(id);
@@ -269,7 +269,7 @@
     
     // Read remote header
     modem_read_fprop(fid, &remote_header, id);
-    g_modem_ready.try_acquire();
+    g_modem_ready.acquire();
     
     // Add file in local file system
     ram_fs_new(fid, (uint8_t*)header, data);
@@ -280,7 +280,7 @@
         HELPER_PRINT("Updating file %d\n", fid);
         // Delete
         modem_delete_file(fid, id);
-        g_modem_ready.try_acquire();
+        g_modem_ready.acquire();
         // Restore in local file system
         ram_fs_new(fid, (uint8_t*)header, data);
         // Re-create
@@ -292,7 +292,7 @@
         {
             modem_create_file(fid, header, id);
         }
-        g_modem_ready.try_acquire();
+        g_modem_ready.acquire();
     }
     else
     {
@@ -351,7 +351,7 @@
     
     // Wait for first boot packet
     HELPER_PRINT("Waiting boot packet...\n");
-    boot.try_acquire();
+    boot.acquire();
     
     // Re-open with user callbacks
     modem_close();
@@ -363,10 +363,10 @@
     ThisThread::sleep_for(1000);
     
     modem_read_file(D7A_FID_UID, uid.b, 0, 8, id);
-    g_modem_ready.try_acquire();
+    g_modem_ready.acquire();
     
     modem_read_file(D7A_FID_FIRMWARE_VERSION, (uint8_t*)&rev, 0, sizeof(revision_t), id);
-    g_modem_ready.try_acquire();
+    g_modem_ready.acquire();
     
     PRINT("------------ D7A Modem infos ------------\r\n");
     PRINT_DATA(" - UID:              ", "%02X", uid.b, 8, "\r\n");