Ping pong app demo.
Dependencies: modem_ref_helper DebouncedInterrupt
modem_callbacks.cpp@8:1b7101152a76, 2018-09-20 (annotated)
- Committer:
- Jeej
- Date:
- Thu Sep 20 11:03:19 2018 +0000
- Revision:
- 8:1b7101152a76
- Parent:
- 3:0979d8cba5ec
- Child:
- 10:b69fe2a98432
Updated libraries and APP for modem v5.2+
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeej | 2:785b422c7d22 | 1 | #include "modem_ref_helper.h" |
Jeej | 0:fa3fd69f8148 | 2 | |
Jeej | 0:fa3fd69f8148 | 3 | |
Jeej | 0:fa3fd69f8148 | 4 | // ============================================================}}} |
Jeej | 0:fa3fd69f8148 | 5 | |
Jeej | 0:fa3fd69f8148 | 6 | // Callbacks to MODEM's ALP requests |
Jeej | 0:fa3fd69f8148 | 7 | // ============================================================{{{ |
Jeej | 0:fa3fd69f8148 | 8 | void my_read(u8 fid, u32 offset, u32 length, int id) |
Jeej | 0:fa3fd69f8148 | 9 | { |
Jeej | 0:fa3fd69f8148 | 10 | modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id); |
Jeej | 0:fa3fd69f8148 | 11 | } |
Jeej | 0:fa3fd69f8148 | 12 | |
Jeej | 0:fa3fd69f8148 | 13 | void my_write(u8 fid, void *data, u32 offset, u32 length, int id) |
Jeej | 0:fa3fd69f8148 | 14 | { |
Jeej | 0:fa3fd69f8148 | 15 | modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id); |
Jeej | 0:fa3fd69f8148 | 16 | } |
Jeej | 0:fa3fd69f8148 | 17 | |
Jeej | 0:fa3fd69f8148 | 18 | void my_read_fprop(u8 fid, int id) |
Jeej | 0:fa3fd69f8148 | 19 | { |
Jeej | 0:fa3fd69f8148 | 20 | modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id); |
Jeej | 0:fa3fd69f8148 | 21 | } |
Jeej | 0:fa3fd69f8148 | 22 | |
Jeej | 0:fa3fd69f8148 | 23 | void my_flush(u8 fid, int id) |
Jeej | 0:fa3fd69f8148 | 24 | { |
Jeej | 0:fa3fd69f8148 | 25 | modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id); |
Jeej | 0:fa3fd69f8148 | 26 | } |
Jeej | 0:fa3fd69f8148 | 27 | |
Jeej | 0:fa3fd69f8148 | 28 | void my_delete(u8 fid, int id) |
Jeej | 0:fa3fd69f8148 | 29 | { |
Jeej | 0:fa3fd69f8148 | 30 | modem_respond(0, ALP_ERR_FILE_NOT_FOUND, id); |
Jeej | 0:fa3fd69f8148 | 31 | } |
Jeej | 0:fa3fd69f8148 | 32 | |
Jeej | 0:fa3fd69f8148 | 33 | void my_lqual(u8 ifid, int per) |
Jeej | 0:fa3fd69f8148 | 34 | { |
Jeej | 0:fa3fd69f8148 | 35 | PRINT("Interface File [%3d] LQUAL : %d%% PER\r\n", ifid, per); |
Jeej | 0:fa3fd69f8148 | 36 | } |
Jeej | 0:fa3fd69f8148 | 37 | |
Jeej | 0:fa3fd69f8148 | 38 | void my_ldown(u8 ifid) |
Jeej | 0:fa3fd69f8148 | 39 | { |
Jeej | 0:fa3fd69f8148 | 40 | PRINT("Interface File [%3d] LDOWN\r\n", ifid); |
Jeej | 0:fa3fd69f8148 | 41 | } |
Jeej | 0:fa3fd69f8148 | 42 | |
Jeej | 0:fa3fd69f8148 | 43 | void my_reset(void) |
Jeej | 0:fa3fd69f8148 | 44 | { |
Jeej | 3:0979d8cba5ec | 45 | PRINT("Restarting application...\r\n"); |
Jeej | 3:0979d8cba5ec | 46 | FLUSH(); |
Jeej | 0:fa3fd69f8148 | 47 | NVIC_SystemReset(); |
Jeej | 0:fa3fd69f8148 | 48 | } |
Jeej | 0:fa3fd69f8148 | 49 | |
Jeej | 0:fa3fd69f8148 | 50 | void my_boot(u8 cause, u16 number) |
Jeej | 0:fa3fd69f8148 | 51 | { |
Jeej | 3:0979d8cba5ec | 52 | PRINT("Modem BOOT[%c] #%d\r\n", cause, number); |
Jeej | 0:fa3fd69f8148 | 53 | |
Jeej | 0:fa3fd69f8148 | 54 | // Modem re-booted, restart APP |
Jeej | 3:0979d8cba5ec | 55 | my_reset(); |
Jeej | 8:1b7101152a76 | 56 | } |
Jeej | 8:1b7101152a76 | 57 | |
Jeej | 8:1b7101152a76 | 58 | void my_busy(u8 busy) |
Jeej | 8:1b7101152a76 | 59 | { |
Jeej | 8:1b7101152a76 | 60 | if (busy) |
Jeej | 8:1b7101152a76 | 61 | { |
Jeej | 8:1b7101152a76 | 62 | PRINT("Modem Busy\r\n"); |
Jeej | 8:1b7101152a76 | 63 | |
Jeej | 8:1b7101152a76 | 64 | /* Stop report, do not use modem */ |
Jeej | 8:1b7101152a76 | 65 | /* Wait for modem reboot or modem not busy */ |
Jeej | 8:1b7101152a76 | 66 | } |
Jeej | 8:1b7101152a76 | 67 | else |
Jeej | 8:1b7101152a76 | 68 | { |
Jeej | 8:1b7101152a76 | 69 | PRINT("Modem not Busy\r\n"); |
Jeej | 8:1b7101152a76 | 70 | |
Jeej | 8:1b7101152a76 | 71 | /* Resume reports */ |
Jeej | 8:1b7101152a76 | 72 | } |
Jeej | 0:fa3fd69f8148 | 73 | } |