p2p+rssi

Dependencies:   pulga-lorawan-drv SX1272

Committer:
afzalsamira
Date:
Thu Jul 08 20:23:06 2021 +0000
Revision:
20:0f0e32d0332c
Parent:
9:cf555a570349
p2p+rssi

Who changed what in which revision?

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