contain lorawan with serial_rx enabled
Dependencies: pulga-lorawan-drv SPI_MX25R Si1133 BME280
Revision 26:f07f5febf97f, committed 2018-06-28
- Comitter:
- mbed_official
- Date:
- Thu Jun 28 12:45:20 2018 +0100
- Parent:
- 25:0f75546d3f3f
- Child:
- 27:cea7485b914e
- Commit message:
- Using string to identify region rather than number
Using EU868 as the region identifier by default and hence giving away the
use of an identification number.
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-lorawan
Changed in this revision
--- a/DummySensor.h Tue Jun 19 14:15:24 2018 +0100 +++ b/DummySensor.h Thu Jun 28 12:45:20 2018 +0100 @@ -24,11 +24,11 @@ class DS1820 { public: - DS1820(uint32_t) { value = 1.0; }; + DS1820(uint32_t) { value = 1.0f; }; bool begin() { return true; }; void startConversion() {}; float read() { - value += 1.1; + value += 1.1f; return value; }
--- a/README.md Tue Jun 19 14:15:24 2018 +0100 +++ b/README.md Thu Jun 28 12:45:20 2018 +0100 @@ -147,7 +147,6 @@ ```json "target_overrides": { "*": { - "target.features_add": ["COMMON_PAL"], "mbed-trace.enable": true } }
--- a/main.cpp Tue Jun 19 14:15:24 2018 +0100 +++ b/main.cpp Thu Jun 28 12:45:20 2018 +0100 @@ -145,7 +145,6 @@ return 0; } - /** * Sends a message to the Network Server */ @@ -174,6 +173,13 @@ if (retcode < 0) { retcode == LORAWAN_STATUS_WOULD_BLOCK ? printf("send - WOULD BLOCK\r\n") : printf("\r\n send() - Error code %d \r\n", retcode); + + if (retcode == LORAWAN_STATUS_WOULD_BLOCK) { + //retry in 3 seconds + if (MBED_CONF_LORA_DUTY_CYCLE_ON) { + ev_queue.call_in(3000, send_message); + } + } return; } @@ -253,6 +259,12 @@ case JOIN_FAILURE: printf("\r\n OTAA Failed - Check Keys \r\n"); break; + case UPLINK_REQUIRED: + printf("\r\n Uplink required by NS \r\n"); + if (MBED_CONF_LORA_DUTY_CYCLE_ON) { + send_message(); + } + break; default: MBED_ASSERT("Unknown Event"); }
--- a/mbed-lora-radio-drv.lib Tue Jun 19 14:15:24 2018 +0100 +++ b/mbed-lora-radio-drv.lib Thu Jun 28 12:45:20 2018 +0100 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers#c4dd25eec9ae30f9532e498ea7e2cacd758c733e +https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers#5532d9d1f4d7c57133aed48c023e332b2a5a24ba \ No newline at end of file
--- a/mbed_app.json Tue Jun 19 14:15:24 2018 +0100 +++ b/mbed_app.json Thu Jun 28 12:45:20 2018 +0100 @@ -32,7 +32,7 @@ "platform.default-serial-baud-rate": 115200, "lora.over-the-air-activation": true, "lora.duty-cycle-on": true, - "lora.phy": 0, + "lora.phy": "EU868", "lora.device-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", "lora.application-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }"
--- a/trace_helper.cpp Tue Jun 19 14:15:24 2018 +0100 +++ b/trace_helper.cpp Thu Jun 28 12:45:20 2018 +0100 @@ -20,53 +20,53 @@ * stack. The library could be made unavailable by removing FEATURE_COMMON_PAL * from the mbed_app.json to save RAM. */ -#if defined(FEATURE_COMMON_PAL) + +#include "mbed_trace.h" - #include "platform/PlatformMutex.h" - #include "mbed_trace.h" +#ifdef FEA_TRACE_SUPPORT +#include "platform/PlatformMutex.h" - /** - * Local mutex object for synchronization - */ - static PlatformMutex mutex; +/** + * Local mutex object for synchronization + */ +static PlatformMutex mutex; - static void serial_lock(); - static void serial_unlock(); +static void serial_lock(); +static void serial_unlock(); - /** - * Sets up trace for the application - * Wouldn't do anything if the FEATURE_COMMON_PAL is not added - * or if the trace is disabled using mbed_app.json - */ - void setup_trace() - { - // setting up Mbed trace. - mbed_trace_mutex_wait_function_set(serial_lock); - mbed_trace_mutex_release_function_set(serial_unlock); - mbed_trace_init(); - } +/** + * Sets up trace for the application + * Wouldn't do anything if the FEATURE_COMMON_PAL is not added + * or if the trace is disabled using mbed_app.json + */ +void setup_trace() +{ + // setting up Mbed trace. + mbed_trace_mutex_wait_function_set(serial_lock); + mbed_trace_mutex_release_function_set(serial_unlock); + mbed_trace_init(); +} - /** - * Lock provided for serial printing used by trace library - */ - static void serial_lock() - { - mutex.lock(); - } +/** + * Lock provided for serial printing used by trace library + */ +static void serial_lock() +{ + mutex.lock(); +} - /** - * Releasing lock provided for serial printing used by trace library - */ - static void serial_unlock() - { - mutex.unlock(); - } +/** + * Releasing lock provided for serial printing used by trace library + */ +static void serial_unlock() +{ + mutex.unlock(); +} +#else +void setup_trace() +{ -#else - - void setup_trace() - { - } - +} #endif +