Sending and reception of big data file (1kB example)
Dependencies: modem_ref_helper CRC DebouncedInterrupt
Diff: main.cpp
- Revision:
- 11:dc0e19b2d4a0
- Parent:
- 9:26cd994b5303
- Child:
- 14:a0241090f967
--- a/main.cpp Thu Oct 11 14:36:35 2018 +0000 +++ b/main.cpp Fri Aug 02 09:02:21 2019 +0000 @@ -26,7 +26,7 @@ // This describe the upload interface // Do not modify uncommented parameters -alp_d7a_itf_t my_itf = { +alp_itf_d7a_cfg_t my_itf = { .type = ALP_ITF_TYPE_D7A, .cfg.to = 0, .cfg.te = 0, @@ -96,7 +96,7 @@ // Wait for button press PRINT("Press user button to send file. (%d bytes)\n", output_length); - button_user.wait(); + button_user.acquire(); // Update file CRC (Calculate CRC on string without end of string) output->crc = crc32((char*)output->data, output_length - 1); @@ -353,7 +353,7 @@ // Put modem to listen to downlink access class d7a_xcl_t xcl = { .bf.s = 0, .bf.m = 0x1 }; modem_write_file(D7A_FID_DLL_CFG, (void*)&xcl, offsetof(d7a_dll_cfg_t, xcl), sizeof(d7a_xcl_t), id); - modem_ready.wait(); + modem_ready.acquire(); PRINT("Register Files\n"); modem_update_file(FID_OUTPUT_FILE, (alp_file_header_t*)&h_output_file, (uint8_t*)&f_output_file); @@ -361,11 +361,11 @@ 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(); PRINT("Notify Modem Version\n"); modem_notify_file(D7A_FID_FIRMWARE_VERSION, 0, SIZE_HOST_REV, id); - modem_ready.wait(); + modem_ready.acquire(); PRINT("Notify Host Version\n"); uint8_t default_root_key[] = DEFAULT_ROOT_KEY; @@ -395,10 +395,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