Program to update the D7A modem's firmware.

Dependencies:   modem_ref_helper DebouncedInterrupt

Revision:
22:f2b01e5e087e
Child:
29:aa16a927f0eb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modem_callbacks.cpp	Mon Sep 18 13:38:40 2017 +0000
@@ -0,0 +1,72 @@
+#include "modem_ref_helper.h"
+
+// ============================================================}}}
+
+// Callbacks to MODEM's ALP requests
+// ============================================================{{{
+void my_read(u8 fid, u32 offset, u32 length, int id)
+{
+    modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id);
+}
+
+void my_write(u8 fid, void *data, u32 offset, u32 length, int id)
+{
+    modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id);
+}
+
+void my_read_fprop(u8 fid, int id)
+{
+    modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id);
+}
+
+void my_flush(u8 fid, int id)
+{
+    modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id);
+}
+
+void my_delete(u8 fid, int id)
+{
+    modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id);
+}
+
+void my_udata(u8 fid,void *data,u32 offset,u32 length, u8 i_type, u8 i_length, u8* i_data)
+{
+    (void)data;
+    (void)i_length;
+    PRINT("Got UNS File[%3d]@%d %d Bytes\n",fid,offset,length);
+    if (i_type == ALP_ITF_TYPE_D7A)
+    {
+        static union {
+            u8      b[8];
+            u32     w[2];
+        } uid;
+        d7a_sp_res_t* istat = (d7a_sp_res_t*) i_data;
+        memcpy(uid.b,istat->addressee.id,8);
+        PRINT("From UID: %08X%08X (snr:%d lb:%d)\n",
+                HAL_U32_BYTE_SWAP(uid.w[0]), HAL_U32_BYTE_SWAP(uid.w[1]),
+                istat->rxlev, istat->lb);
+    }
+}
+
+void my_lqual(u8 ifid, int per)
+{
+    PRINT("Interface File [%3d] LQUAL : %d%% PER\r\n", ifid, per);
+}
+
+void my_ldown(u8 ifid)
+{
+    PRINT("Interface File [%3d] LDOWN\r\n", ifid);
+}
+
+void my_reset(void)
+{
+    NVIC_SystemReset();
+}
+
+void my_boot(u8 cause, u16 number)
+{
+    PRINT("Modem BOOT[%c] #%d\r\nRe-Init\r\n", cause, number);
+    
+    // Modem re-booted, restart APP
+    my_reset();
+}
\ No newline at end of file