Fork for Get Started Demo
Dependencies: DebouncedInterrupt dash7-alp mbed-rtos mbed wizzi-utils
Fork of D7A_Demo_full by
Diff: main.cpp
- Revision:
- 10:e16d5cfd4198
- Parent:
- 8:9beb450228d4
- Child:
- 11:1a5a4f7cc5d3
--- a/main.cpp Thu Nov 26 09:06:28 2015 +0000 +++ b/main.cpp Mon Nov 30 15:18:13 2015 +0000 @@ -126,8 +126,8 @@ .rts = PA_5, .cts = PC_7, .rx_buffer_size = 256, - .local_timeout = 500, - .distant_timeout = 2000, + .local_timeout = 200, + .distant_timeout = 3000, .write = d7_write_file, .read = d7_read_file, }; @@ -184,14 +184,14 @@ // This Thread monitors the user button // and reports the alarm status void alarm_thread( const void* args ) -{ +{ // Get modem D7_modem* wm1001 = (D7_modem*)args; // Enable interrupt on User button DebouncedInterrupt button(USER_BUTTON); - button.attach(&button_push_isr, IRQ_FALL, 200); - + button.attach(&button_push_isr, IRQ_FALL, 500, true); + while(true) { // Wait for button press @@ -201,6 +201,7 @@ alarm_data.status = !alarm_data.status; PRINT("NOTIFY ALARM STATE CHANGE %d\r\n", alarm_data.status); + FLUSH(); // Notify alarm status check_status(wm1001->notify_filechange(ALARM_DATA_FILE_ID), "ALARM REPORT"); @@ -244,20 +245,14 @@ // Initialize ALP modem D7_modem wm1001(&shield1001_config, PB_0); - // Reset modem - wm1001.reset(); - - // Check the boot packets - ASSERT(wm1001.wait_boot() == ALP_ERR_NO, "BOOT FAIL!\r\n"); - // Wait for modem to notify its files if there is any - Thread::wait(200); + Thread::wait(500); // Register the files wm1001.register_file(&revision_device_fh); wm1001.register_file(&alarm_data_fh); wm1001.register_file(&alarm_cmd_fh); - wm1001.register_file(&temp_data_fh); + wm1001.register_file(&temp_data_fh); // Send the Revision report PRINT("NOTIFY REVISION\r\n");