Lorawan to Pulga

Dependencies:   pulga-lorawan-drv SPI_MX25R Si1133 BME280

Committer:
mbed_official
Date:
Thu Jun 28 12:45:20 2018 +0100
Revision:
26:f07f5febf97f
Parent:
17:2fc16c1d6434
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

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:7037ed05f54f 1 /**
mbed_official 0:7037ed05f54f 2 * Copyright (c) 2017, Arm Limited and affiliates.
mbed_official 0:7037ed05f54f 3 * SPDX-License-Identifier: Apache-2.0
mbed_official 0:7037ed05f54f 4 *
mbed_official 0:7037ed05f54f 5 * Licensed under the Apache License, Version 2.0 (the "License");
mbed_official 0:7037ed05f54f 6 * you may not use this file except in compliance with the License.
mbed_official 0:7037ed05f54f 7 * You may obtain a copy of the License at
mbed_official 0:7037ed05f54f 8 *
mbed_official 0:7037ed05f54f 9 * http://www.apache.org/licenses/LICENSE-2.0
mbed_official 0:7037ed05f54f 10 *
mbed_official 0:7037ed05f54f 11 * Unless required by applicable law or agreed to in writing, software
mbed_official 0:7037ed05f54f 12 * distributed under the License is distributed on an "AS IS" BASIS,
mbed_official 0:7037ed05f54f 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbed_official 0:7037ed05f54f 14 * See the License for the specific language governing permissions and
mbed_official 0:7037ed05f54f 15 * limitations under the License.
mbed_official 0:7037ed05f54f 16 */
mbed_official 0:7037ed05f54f 17
mbed_official 0:7037ed05f54f 18 /**
mbed_official 0:7037ed05f54f 19 * If we have tracing library available, we can see traces from within the
mbed_official 0:7037ed05f54f 20 * stack. The library could be made unavailable by removing FEATURE_COMMON_PAL
mbed_official 0:7037ed05f54f 21 * from the mbed_app.json to save RAM.
mbed_official 0:7037ed05f54f 22 */
mbed_official 26:f07f5febf97f 23
mbed_official 26:f07f5febf97f 24 #include "mbed_trace.h"
mbed_official 0:7037ed05f54f 25
mbed_official 26:f07f5febf97f 26 #ifdef FEA_TRACE_SUPPORT
mbed_official 26:f07f5febf97f 27 #include "platform/PlatformMutex.h"
mbed_official 0:7037ed05f54f 28
mbed_official 26:f07f5febf97f 29 /**
mbed_official 26:f07f5febf97f 30 * Local mutex object for synchronization
mbed_official 26:f07f5febf97f 31 */
mbed_official 26:f07f5febf97f 32 static PlatformMutex mutex;
mbed_official 0:7037ed05f54f 33
mbed_official 26:f07f5febf97f 34 static void serial_lock();
mbed_official 26:f07f5febf97f 35 static void serial_unlock();
mbed_official 0:7037ed05f54f 36
mbed_official 26:f07f5febf97f 37 /**
mbed_official 26:f07f5febf97f 38 * Sets up trace for the application
mbed_official 26:f07f5febf97f 39 * Wouldn't do anything if the FEATURE_COMMON_PAL is not added
mbed_official 26:f07f5febf97f 40 * or if the trace is disabled using mbed_app.json
mbed_official 26:f07f5febf97f 41 */
mbed_official 26:f07f5febf97f 42 void setup_trace()
mbed_official 26:f07f5febf97f 43 {
mbed_official 26:f07f5febf97f 44 // setting up Mbed trace.
mbed_official 26:f07f5febf97f 45 mbed_trace_mutex_wait_function_set(serial_lock);
mbed_official 26:f07f5febf97f 46 mbed_trace_mutex_release_function_set(serial_unlock);
mbed_official 26:f07f5febf97f 47 mbed_trace_init();
mbed_official 26:f07f5febf97f 48 }
mbed_official 0:7037ed05f54f 49
mbed_official 26:f07f5febf97f 50 /**
mbed_official 26:f07f5febf97f 51 * Lock provided for serial printing used by trace library
mbed_official 26:f07f5febf97f 52 */
mbed_official 26:f07f5febf97f 53 static void serial_lock()
mbed_official 26:f07f5febf97f 54 {
mbed_official 26:f07f5febf97f 55 mutex.lock();
mbed_official 26:f07f5febf97f 56 }
mbed_official 0:7037ed05f54f 57
mbed_official 26:f07f5febf97f 58 /**
mbed_official 26:f07f5febf97f 59 * Releasing lock provided for serial printing used by trace library
mbed_official 26:f07f5febf97f 60 */
mbed_official 26:f07f5febf97f 61 static void serial_unlock()
mbed_official 26:f07f5febf97f 62 {
mbed_official 26:f07f5febf97f 63 mutex.unlock();
mbed_official 26:f07f5febf97f 64 }
mbed_official 26:f07f5febf97f 65 #else
mbed_official 26:f07f5febf97f 66 void setup_trace()
mbed_official 26:f07f5febf97f 67 {
mbed_official 0:7037ed05f54f 68
mbed_official 26:f07f5febf97f 69 }
mbed_official 0:7037ed05f54f 70 #endif
mbed_official 0:7037ed05f54f 71
mbed_official 26:f07f5febf97f 72