Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of d7a_1x by
Diff: src/d7a_sys.cpp
- Revision:
- 29:8e7c5c1e9aab
- Parent:
- 28:0376b97b4b55
- Child:
- 30:d775c1409849
--- a/src/d7a_sys.cpp Mon Apr 04 14:00:28 2016 +0000 +++ b/src/d7a_sys.cpp Tue May 03 16:53:52 2016 +0000 @@ -10,6 +10,7 @@ typedef struct { Thread* thread; Queue<d7a_com_rx_msg_t, 16> pkt_queue; + Queue<bool, 1> wait_pong; } d7a_sys_ctx_t; d7a_sys_ctx_t g_sys_ctx; @@ -50,6 +51,23 @@ d7a_com_send_msg(&msg); } +bool d7a_sys_ping_modem(void) +{ + FPRINT("\r\n"); + d7a_com_tx_msg_t msg; + uint8_t buf[5] = "PING"; + msg.id = KAL_COM_FLOW_SYS_PING; + msg.pbuf = buf; + msg.plen = 4; + msg.alen = 0; + d7a_com_send_msg(&msg); + + osEvent evt = g_sys_ctx.wait_pong.get(100); + + return (evt.status == osEventMessage)? true: false; +} + + void d7a_sys_thread(const void *p) { FPRINT("\r\n"); @@ -88,6 +106,7 @@ break; case KAL_COM_FLOW_SYS_PONG: DPRINT("KAL_COM_FLOW_SYS_PONG\r\n"); + g_sys_ctx.wait_pong.put(NULL); break; case KAL_COM_FLOW_SYS_CFG: DPRINT("KAL_COM_FLOW_SYS_CFG\r\n");