You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add target option to redirect NRF_LOG_* logging to mbed logging (stdout)
Modify the SDK11 softdevice_enable() logging to not dependent on Segger RTT being present & enabled.
This change is not required in any later versions of SDK
Copy file name to clipboardExpand all lines: targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_11/softdevice/common/softdevice_handler/softdevice_handler.c
* Licensed under the Apache License, Version 2.0 (the "License");
5
+
* you may not use this file except in compliance with the License.
6
+
* You may obtain a copy of the License at
7
+
*
8
+
* http://www.apache.org/licenses/LICENSE-2.0
9
+
*
10
+
* Unless required by applicable law or agreed to in writing, software
11
+
* distributed under the License is distributed on an "AS IS" BASIS,
12
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+
* See the License for the specific language governing permissions and
14
+
* limitations under the License.
15
+
*/
16
+
17
+
#ifndefAPP_UART_H_
18
+
#defineAPP_UART_H_
19
+
20
+
// This replacement <app_uart.h> provides forwarding of nrf logging to
21
+
// stdout when NRF_LOG_USES_UART is enabled
22
+
23
+
#include<stdio.h>
24
+
#include"nrf_error.h"
25
+
#include"nrf51_bitfields.h"
26
+
#include"cmsis_compiler.h"
27
+
28
+
#defineapp_uart_put(c) putc(c, stdout)
29
+
30
+
__STATIC_INLINEuint32_tapp_uart_get(uint8_t*c) {
31
+
*c=getc(stdin);
32
+
returnNRF_SUCCESS;
33
+
}
34
+
35
+
/**@brief UART Flow Control modes for the peripheral.
36
+
*/
37
+
typedefenum
38
+
{
39
+
APP_UART_FLOW_CONTROL_DISABLED, /**< UART Hw Flow Control is disabled. */
40
+
APP_UART_FLOW_CONTROL_ENABLED, /**< Standard UART Hw Flow Control is enabled. */
41
+
APP_UART_FLOW_CONTROL_LOW_POWER/**< Specialized UART Hw Flow Control is used. The Low Power setting allows the \nRFXX to Power Off the UART module when CTS is in-active, and re-enabling the UART when the CTS signal becomes active. This allows the \nRFXX to safe power by only using the UART module when it is needed by the remote site. */
42
+
} app_uart_flow_control_t;
43
+
44
+
45
+
/**@brief Enumeration which defines events used by the UART module upon data reception or error.
46
+
*
47
+
* @details The event type is used to indicate the type of additional information in the event
48
+
* @ref app_uart_evt_t.
49
+
*/
50
+
typedefenum
51
+
{
52
+
APP_UART_DATA_READY, /**< An event indicating that UART data has been received. The data is available in the FIFO and can be fetched using @ref app_uart_get. */
53
+
APP_UART_FIFO_ERROR, /**< An error in the FIFO module used by the app_uart module has occured. The FIFO error code is stored in app_uart_evt_t.data.error_code field. */
54
+
APP_UART_COMMUNICATION_ERROR, /**< An communication error has occured during reception. The error is stored in app_uart_evt_t.data.error_communication field. */
55
+
APP_UART_TX_EMPTY, /**< An event indicating that UART has completed transmission of all available data in the TX FIFO. */
56
+
APP_UART_DATA, /**< An event indicating that UART data has been received, and data is present in data field. This event is only used when no FIFO is configured. */
57
+
} app_uart_evt_type_t;
58
+
59
+
60
+
/**@brief UART communication structure holding configuration settings for the peripheral.
61
+
*/
62
+
typedefstruct
63
+
{
64
+
uint8_trx_pin_no; /**< RX pin number. */
65
+
uint8_ttx_pin_no; /**< TX pin number. */
66
+
uint8_trts_pin_no; /**< RTS pin number, only used if flow control is enabled. */
67
+
uint8_tcts_pin_no; /**< CTS pin number, only used if flow control is enabled. */
68
+
app_uart_flow_control_tflow_control; /**< Flow control setting, if flow control is used, the system will use low power UART mode, based on CTS signal. */
69
+
booluse_parity; /**< Even parity if TRUE, no parity if FALSE. */
/**@brief Struct containing events from the UART module.
74
+
*
75
+
* @details The app_uart_evt_t is used to notify the application of asynchronous events when data
76
+
* are received on the UART peripheral or in case an error occured during data reception.
77
+
*/
78
+
typedefstruct
79
+
{
80
+
app_uart_evt_type_tevt_type; /**< Type of event. */
81
+
union
82
+
{
83
+
uint32_terror_communication; /**< Field used if evt_type is: APP_UART_COMMUNICATION_ERROR. This field contains the value in the ERRORSRC register for the UART peripheral. The UART_ERRORSRC_x defines from nrf5x_bitfields.h can be used to parse the error code. See also the \nRFXX Series Reference Manual for specification. */
84
+
uint32_terror_code; /**< Field used if evt_type is: NRF_ERROR_x. Additional status/error code if the error event type is APP_UART_FIFO_ERROR. This error code refer to errors defined in nrf_error.h. */
85
+
uint8_tvalue; /**< Field used if evt_type is: NRF_ERROR_x. Additional status/error code if the error event type is APP_UART_FIFO_ERROR. This error code refer to errors defined in nrf_error.h. */
0 commit comments