Helper library to use modem_ref driver.
Dependencies: WizziCom WizziDebug ram_fs modem_ref
Dependents: D7A_Localisation D7A_1x_demo_send_file_data_and_forget D7A_1x_demo_CodeUpgradeProtocol D7A_1x_demo_LoRaWAN ... more
Diff: modem_ref_helper.cpp
- Revision:
- 47:cf88f0f370cb
- Parent:
- 45:382159015b55
- Child:
- 48:beb06c0bdb1e
diff -r 7f8a0228bcf8 -r cf88f0f370cb modem_ref_helper.cpp --- a/modem_ref_helper.cpp Fri Oct 12 12:43:46 2018 +0000 +++ b/modem_ref_helper.cpp Wed Oct 17 09:20:58 2018 +0000 @@ -9,6 +9,7 @@ #define MODEM_VERSION_MAJOR 5 #define MODEM_VERSION_MINOR 0 #define MODEM_VERSION_PATCH 36 +#define MODEM_DEVICE_ID 0x00001001 static WizziCom* g_modem_com; static Semaphore g_modem_ready; @@ -366,23 +367,31 @@ PRINT(" - Firmware version: v%d.%d.%d [%02X]\r\n", rev.fw_version.major, rev.fw_version.minor, rev.fw_version.patch, rev.fw_version.id); PRINT(" - CUP max size: %d\r\n", rev.cup_max_size); PRINT("-----------------------------------------\r\n"); - - // Check version - uint32_t rev_sum1 = (rev.fw_version.major << 24) | (rev.fw_version.minor << 16) | rev.fw_version.patch; - uint32_t rev_sum2 = (MODEM_VERSION_MAJOR << 24) | (MODEM_VERSION_MINOR << 16) | MODEM_VERSION_PATCH; - if (rev_sum1 < rev_sum2) + + if (MODEM_DEVICE_ID == rev.device_id) { - PRINT("\r\nYou need a modem at version %d.%d.%d or above to use this Driver.\r\n" - "You can:\r\n" - " - Check modem updates on the Dash7Board:\r\n" - " Go to your site's version manager.\r\n" - " - Check modem updates by importing:\r\n" - " https://developer.mbed.org/teams/WizziLab/code/D7A_WM_Updater\r\n" - " - Choose the right 'modem_ref_helper' revision.\r\n" - " Right click on modem_ref_helper -> Revision.\r\n" - , MODEM_VERSION_MAJOR, MODEM_VERSION_MINOR, MODEM_VERSION_PATCH); - - Thread::wait(osWaitForever); + // Check version + uint32_t rev_sum1 = (rev.fw_version.major << 24) | (rev.fw_version.minor << 16) | rev.fw_version.patch; + uint32_t rev_sum2 = (MODEM_VERSION_MAJOR << 24) | (MODEM_VERSION_MINOR << 16) | MODEM_VERSION_PATCH; + if (rev_sum1 < rev_sum2) + { + PRINT("\r\nYou need a modem at version %d.%d.%d or above to use this Driver.\r\n" + "You can:\r\n" + " - Check modem updates on the Dash7Board:\r\n" + " Go to your site's version manager.\r\n" + " - Check modem updates by importing:\r\n" + " https://developer.mbed.org/teams/WizziLab/code/D7A_WM_Updater\r\n" + " - Choose the right 'modem_ref_helper' revision.\r\n" + " Right click on modem_ref_helper -> Revision.\r\n" + , MODEM_VERSION_MAJOR, MODEM_VERSION_MINOR, MODEM_VERSION_PATCH); + + Thread::wait(osWaitForever); + } + } + else + { + // Do not check version + PRINT("/!\\ Not a modem firmware /!\\\r\n"); } modem_free_id(id);