Scan example on D7-LoRa

Dependencies:   modem_ref_helper DebouncedInterrupt

Revision:
5:8c7ce9a28169
Parent:
3:c1a36c817c48
Child:
7:7d9414d33a63
--- a/main.cpp	Thu Oct 11 14:38:27 2018 +0000
+++ b/main.cpp	Fri Aug 02 13:29:58 2019 +0000
@@ -101,7 +101,7 @@
     {
         // Wait for button press
         PRINT("Press button to scan...\r\n");
-        button_user.wait();
+        button_user.acquire();
         
         for (uint8_t i = 0; i < sizeof(scan_xcl); i++)
         {
@@ -188,35 +188,35 @@
     
     // Put modem to listen to downlink access class
     modem_write_file(D7A_FID_DLL_CFG, &XCL_DL, offsetof(d7a_dll_cfg_t, xcl), sizeof(d7a_xcl_t), id);
-    modem_ready.wait();
+    modem_ready.acquire();
     
     // Configure interfaces to use uplink access class
     modem_write_file(IFID_ONESHOT_HOST, &XCL_UL, offsetof(alp_d7a_itf_t, cfg.addressee.xcl), sizeof(d7a_xcl_t), id);
-    modem_ready.wait();
+    modem_ready.acquire();
     
     modem_write_file(IFID_ONESHOT_ACTP, &XCL_UL, offsetof(alp_d7a_itf_t, cfg.addressee.xcl), sizeof(d7a_xcl_t), id);
-    modem_ready.wait();
+    modem_ready.acquire();
     
     modem_write_file(IFID_REPORT, &XCL_UL, offsetof(alp_d7a_itf_t, cfg.addressee.xcl), sizeof(d7a_xcl_t), id);
-    modem_ready.wait();
+    modem_ready.acquire();
     
     // Configure duty
     d7a_ctf_t duty = { .byte = DUTY };
     for (int i = 0; i < 8; i++)
     {
         modem_write_file(D7A_FID_ACCESS_PROFILE_0 + XCL_DL.bf.s, &duty, offsetof(d7a_access_profile_t, sb[0].duty) + (i * sizeof(d7a_subband_t)), sizeof(d7a_ctf_t), id);
-        modem_ready.wait();
+        modem_ready.acquire();
     }
     
     for (int i = 0; i < 8; i++)
     {
         modem_write_file(D7A_FID_ACCESS_PROFILE_0 + XCL_UL.bf.s, &duty, offsetof(d7a_access_profile_t, sb[0].duty) + (i * sizeof(d7a_subband_t)), sizeof(d7a_ctf_t), id);
-        modem_ready.wait();
+        modem_ready.acquire();
     }
     
     PRINT("Start D7A Stack\n");
     modem_activate_itf(ALP_ITF_TYPE_D7A, 24, 0, ALP_D7A_ISTAT_RESP | ALP_D7A_ISTAT_UNS | ALP_D7A_ISTAT_EOP, true, id);
-    modem_ready.wait();
+    modem_ready.acquire();
     
     modem_free_id(id);
 
@@ -236,10 +236,10 @@
 #endif
     
     // Set main task to lowest priority
-    osThreadSetPriority(osThreadGetId(), osPriorityIdle);
+    osThreadSetPriority(osThreadGetId(), osPriorityLow);
     while(true)
     {
-        Thread::wait(500);
+        ThisThread::sleep_for(500);
 #ifdef DEBUG_LED
         my_led = !my_led;
 #endif