iOSのBLEコントローラアプリ「RCBController」とmbed HRM1017を接続し、RCサーボモータを操作するテストプログラムです。

Dependencies:   BLE_API_Native_IRC Servo mbed

Fork of BLE_RCBController by Junichi Katsu

  • 古いBLEライブラリを使っているのでプラットフォームは”Nordic nRF51822”を選択してください。
  • ライブラリ類はUpdateしないでください。コンパイルエラーになります。

うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。

/media/uploads/robo8080/img_1560.jpg

Committer:
jksoft
Date:
Thu Jul 10 14:21:52 2014 +0000
Revision:
0:8c643bfe55b7
??

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8c643bfe55b7 1 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
jksoft 0:8c643bfe55b7 2 *
jksoft 0:8c643bfe55b7 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 0:8c643bfe55b7 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 0:8c643bfe55b7 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 0:8c643bfe55b7 6 *
jksoft 0:8c643bfe55b7 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 0:8c643bfe55b7 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 0:8c643bfe55b7 9 * the file.
jksoft 0:8c643bfe55b7 10 *
jksoft 0:8c643bfe55b7 11 */
jksoft 0:8c643bfe55b7 12
jksoft 0:8c643bfe55b7 13 /**@file
jksoft 0:8c643bfe55b7 14 *
jksoft 0:8c643bfe55b7 15 * @defgroup app_uart UART module
jksoft 0:8c643bfe55b7 16 * @{
jksoft 0:8c643bfe55b7 17 * @ingroup app_common
jksoft 0:8c643bfe55b7 18 *
jksoft 0:8c643bfe55b7 19 * @brief UART module interface.
jksoft 0:8c643bfe55b7 20 */
jksoft 0:8c643bfe55b7 21
jksoft 0:8c643bfe55b7 22 #ifndef APP_UART_H__
jksoft 0:8c643bfe55b7 23 #define APP_UART_H__
jksoft 0:8c643bfe55b7 24
jksoft 0:8c643bfe55b7 25 #include <stdint.h>
jksoft 0:8c643bfe55b7 26 #include <stdbool.h>
jksoft 0:8c643bfe55b7 27 #include "nordic_global.h"
jksoft 0:8c643bfe55b7 28 #include "app_util.h"
jksoft 0:8c643bfe55b7 29
jksoft 0:8c643bfe55b7 30 #define UART_PIN_DISCONNECTED 0xFFFFFFFF /**< Value indicating that no pin is connected to this UART register. */
jksoft 0:8c643bfe55b7 31
jksoft 0:8c643bfe55b7 32 /**@brief UART Flow Control modes for the peripheral.
jksoft 0:8c643bfe55b7 33 */
jksoft 0:8c643bfe55b7 34 typedef enum
jksoft 0:8c643bfe55b7 35 {
jksoft 0:8c643bfe55b7 36 APP_UART_FLOW_CONTROL_DISABLED, /**< UART Hw Flow Control is disabled. */
jksoft 0:8c643bfe55b7 37 APP_UART_FLOW_CONTROL_ENABLED, /**< Standard UART Hw Flow Control is enabled. */
jksoft 0:8c643bfe55b7 38 APP_UART_FLOW_CONTROL_LOW_POWER /**< Specialized UART Hw Flow Control is used. The Low Power setting allows the nRF51 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 nRF51 to safe power by only using the UART module when it is needed by the remote site. */
jksoft 0:8c643bfe55b7 39 } app_uart_flow_control_t;
jksoft 0:8c643bfe55b7 40
jksoft 0:8c643bfe55b7 41 /**@brief UART communication structure holding configuration settings for the peripheral.
jksoft 0:8c643bfe55b7 42 */
jksoft 0:8c643bfe55b7 43 typedef struct
jksoft 0:8c643bfe55b7 44 {
jksoft 0:8c643bfe55b7 45 uint8_t rx_pin_no; /**< RX pin number. */
jksoft 0:8c643bfe55b7 46 uint8_t tx_pin_no; /**< TX pin number. */
jksoft 0:8c643bfe55b7 47 uint8_t rts_pin_no; /**< RTS pin number, only used if flow control is enabled. */
jksoft 0:8c643bfe55b7 48 uint8_t cts_pin_no; /**< CTS pin number, only used if flow control is enabled. */
jksoft 0:8c643bfe55b7 49 app_uart_flow_control_t flow_control; /**< Flow control setting, if flow control is used, the system will use low power UART mode, based on CTS signal. */
jksoft 0:8c643bfe55b7 50 bool use_parity; /**< Even parity if TRUE, no parity if FALSE. */
jksoft 0:8c643bfe55b7 51 uint32_t baud_rate; /**< Baud rate configuration. */
jksoft 0:8c643bfe55b7 52 } app_uart_comm_params_t;
jksoft 0:8c643bfe55b7 53
jksoft 0:8c643bfe55b7 54 /**@brief UART buffer for transmitting/receiving data.
jksoft 0:8c643bfe55b7 55 */
jksoft 0:8c643bfe55b7 56 typedef struct
jksoft 0:8c643bfe55b7 57 {
jksoft 0:8c643bfe55b7 58 uint8_t * rx_buf; /**< Pointer to the RX buffer. */
jksoft 0:8c643bfe55b7 59 uint32_t rx_buf_size; /**< Size of the RX buffer. */
jksoft 0:8c643bfe55b7 60 uint8_t * tx_buf; /**< Pointer to the TX buffer. */
jksoft 0:8c643bfe55b7 61 uint32_t tx_buf_size; /**< Size of the TX buffer. */
jksoft 0:8c643bfe55b7 62 } app_uart_buffers_t;
jksoft 0:8c643bfe55b7 63
jksoft 0:8c643bfe55b7 64 /**@brief Enumeration describing current state of the UART.
jksoft 0:8c643bfe55b7 65 *
jksoft 0:8c643bfe55b7 66 * @details The connection state can be fetched by the application using the function call
jksoft 0:8c643bfe55b7 67 * @ref app_uart_get_connection_state.
jksoft 0:8c643bfe55b7 68 * When hardware flow control is used
jksoft 0:8c643bfe55b7 69 * - APP_UART_CONNECTED: Communication is ongoing.
jksoft 0:8c643bfe55b7 70 * - APP_UART_DISCONNECTED: No communication is ongoing.
jksoft 0:8c643bfe55b7 71 *
jksoft 0:8c643bfe55b7 72 * When no hardware flow control is used
jksoft 0:8c643bfe55b7 73 * - APP_UART_CONNECTED: Always returned as bytes can always be received/transmitted.
jksoft 0:8c643bfe55b7 74 */
jksoft 0:8c643bfe55b7 75 typedef enum
jksoft 0:8c643bfe55b7 76 {
jksoft 0:8c643bfe55b7 77 APP_UART_DISCONNECTED, /**< State indicating that the UART is disconnected and cannot receive or transmit bytes. */
jksoft 0:8c643bfe55b7 78 APP_UART_CONNECTED /**< State indicating that the UART is connected and ready to receive or transmit bytes. If flow control is disabled, the state will always be connected. */
jksoft 0:8c643bfe55b7 79 } app_uart_connection_state_t;
jksoft 0:8c643bfe55b7 80
jksoft 0:8c643bfe55b7 81 /**@brief Enumeration which defines events used by the UART module upon data reception or error.
jksoft 0:8c643bfe55b7 82 *
jksoft 0:8c643bfe55b7 83 * @details The event type is used to indicate the type of additional information in the event
jksoft 0:8c643bfe55b7 84 * @ref app_uart_evt_t.
jksoft 0:8c643bfe55b7 85 */
jksoft 0:8c643bfe55b7 86 typedef enum
jksoft 0:8c643bfe55b7 87 {
jksoft 0:8c643bfe55b7 88 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. */
jksoft 0:8c643bfe55b7 89 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. */
jksoft 0:8c643bfe55b7 90 APP_UART_COMMUNICATION_ERROR, /**< An communication error has occured during reception. The error is stored in app_uart_evt_t.data.error_communication field. */
jksoft 0:8c643bfe55b7 91 APP_UART_TX_EMPTY, /**< An event indicating that UART has completed transmission of all available data in the TX FIFO. */
jksoft 0:8c643bfe55b7 92 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. */
jksoft 0:8c643bfe55b7 93 } app_uart_evt_type_t;
jksoft 0:8c643bfe55b7 94
jksoft 0:8c643bfe55b7 95 /**@brief Struct containing events from the UART module.
jksoft 0:8c643bfe55b7 96 *
jksoft 0:8c643bfe55b7 97 * @details The app_uart_evt_t is used to notify the application of asynchronous events when data
jksoft 0:8c643bfe55b7 98 * are received on the UART peripheral or in case an error occured during data reception.
jksoft 0:8c643bfe55b7 99 */
jksoft 0:8c643bfe55b7 100 typedef struct
jksoft 0:8c643bfe55b7 101 {
jksoft 0:8c643bfe55b7 102 app_uart_evt_type_t evt_type; /**< Type of event. */
jksoft 0:8c643bfe55b7 103 union
jksoft 0:8c643bfe55b7 104 {
jksoft 0:8c643bfe55b7 105 uint32_t error_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 @ref nrf51_bitfields.h can be used to parse the error code. See also the nRF51 Series Reference Manual for specification. */
jksoft 0:8c643bfe55b7 106 uint32_t error_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. */
jksoft 0:8c643bfe55b7 107 uint8_t value; /**< 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. */
jksoft 0:8c643bfe55b7 108 } data;
jksoft 0:8c643bfe55b7 109 } app_uart_evt_t;
jksoft 0:8c643bfe55b7 110
jksoft 0:8c643bfe55b7 111 /**@brief Function for handling app_uart event callback.
jksoft 0:8c643bfe55b7 112 *
jksoft 0:8c643bfe55b7 113 * @details Upon an event in the app_uart module this callback function will be called to notify
jksoft 0:8c643bfe55b7 114 * the applicatioon about the event.
jksoft 0:8c643bfe55b7 115 *
jksoft 0:8c643bfe55b7 116 * @param[in] p_app_uart_event Pointer to UART event.
jksoft 0:8c643bfe55b7 117 */
jksoft 0:8c643bfe55b7 118 typedef void (*app_uart_event_handler_t) (app_uart_evt_t * p_app_uart_event);
jksoft 0:8c643bfe55b7 119
jksoft 0:8c643bfe55b7 120 /**@brief Macro for safe initialization of the UART module in a single user instance when using
jksoft 0:8c643bfe55b7 121 * a FIFO together with UART.
jksoft 0:8c643bfe55b7 122 *
jksoft 0:8c643bfe55b7 123 * @param[in] P_COMM_PARAMS Pointer to a UART communication structure: app_uart_comm_params_t
jksoft 0:8c643bfe55b7 124 * @param[in] RX_BUF_SIZE Size of desired RX buffer, must be a power of 2 or ZERO (No FIFO).
jksoft 0:8c643bfe55b7 125 * @param[in] TX_BUF_SIZE Size of desired TX buffer, must be a power of 2 or ZERO (No FIFO).
jksoft 0:8c643bfe55b7 126 * @param[in] EVENT_HANDLER Event handler function to be called when an event occurs in the
jksoft 0:8c643bfe55b7 127 * UART module.
jksoft 0:8c643bfe55b7 128 * @param[in] IRQ_PRIO IRQ priority, app_irq_priority_t, for the UART module irq handler.
jksoft 0:8c643bfe55b7 129 * @param[out] ERR_CODE The return value of the UART initialization function will be
jksoft 0:8c643bfe55b7 130 * written to this parameter.
jksoft 0:8c643bfe55b7 131 *
jksoft 0:8c643bfe55b7 132 * @note Since this macro allocates a buffer and registers the module as a GPIOTE user when flow
jksoft 0:8c643bfe55b7 133 * control is enabled, it must only be called once.
jksoft 0:8c643bfe55b7 134 */
jksoft 0:8c643bfe55b7 135 #define APP_UART_FIFO_INIT(P_COMM_PARAMS, RX_BUF_SIZE, TX_BUF_SIZE, EVT_HANDLER, IRQ_PRIO, ERR_CODE)\
jksoft 0:8c643bfe55b7 136 do \
jksoft 0:8c643bfe55b7 137 { \
jksoft 0:8c643bfe55b7 138 uint16_t APP_UART_UID = 0; \
jksoft 0:8c643bfe55b7 139 app_uart_buffers_t buffers; \
jksoft 0:8c643bfe55b7 140 static uint8_t rx_buf[RX_BUF_SIZE]; \
jksoft 0:8c643bfe55b7 141 static uint8_t tx_buf[TX_BUF_SIZE]; \
jksoft 0:8c643bfe55b7 142 \
jksoft 0:8c643bfe55b7 143 buffers.rx_buf = rx_buf; \
jksoft 0:8c643bfe55b7 144 buffers.rx_buf_size = sizeof(rx_buf); \
jksoft 0:8c643bfe55b7 145 buffers.tx_buf = tx_buf; \
jksoft 0:8c643bfe55b7 146 buffers.tx_buf_size = sizeof(tx_buf); \
jksoft 0:8c643bfe55b7 147 ERR_CODE = app_uart_init(P_COMM_PARAMS, &buffers, EVT_HANDLER, IRQ_PRIO, &APP_UART_UID); \
jksoft 0:8c643bfe55b7 148 } while (0)
jksoft 0:8c643bfe55b7 149
jksoft 0:8c643bfe55b7 150 /**@brief Macro for safe initialization of the UART module in a single user instance.
jksoft 0:8c643bfe55b7 151 *
jksoft 0:8c643bfe55b7 152 * @param[in] P_COMM_PARAMS Pointer to a UART communication structure: app_uart_comm_params_t
jksoft 0:8c643bfe55b7 153 * @param[in] EVENT_HANDLER Event handler function to be called when an event occurs in the
jksoft 0:8c643bfe55b7 154 * UART module.
jksoft 0:8c643bfe55b7 155 * @param[in] IRQ_PRIO IRQ priority, app_irq_priority_t, for the UART module irq handler.
jksoft 0:8c643bfe55b7 156 * @param[out] ERR_CODE The return value of the UART initialization function will be
jksoft 0:8c643bfe55b7 157 * written to this parameter.
jksoft 0:8c643bfe55b7 158 *
jksoft 0:8c643bfe55b7 159 * @note Since this macro allocates registers the module as a GPIOTE user when flow control is
jksoft 0:8c643bfe55b7 160 * enabled, it must only be called once.
jksoft 0:8c643bfe55b7 161 */
jksoft 0:8c643bfe55b7 162 #define APP_UART_INIT(P_COMM_PARAMS, EVT_HANDLER, IRQ_PRIO, ERR_CODE) \
jksoft 0:8c643bfe55b7 163 do \
jksoft 0:8c643bfe55b7 164 { \
jksoft 0:8c643bfe55b7 165 uint16_t APP_UART_UID = 0; \
jksoft 0:8c643bfe55b7 166 ERR_CODE = app_uart_init(P_COMM_PARAMS, NULL, EVT_HANDLER, IRQ_PRIO, &APP_UART_UID); \
jksoft 0:8c643bfe55b7 167 } while (0)
jksoft 0:8c643bfe55b7 168
jksoft 0:8c643bfe55b7 169 /**@brief Function for initializing the UART module. Use this initialization when several instances of the UART
jksoft 0:8c643bfe55b7 170 * module are needed.
jksoft 0:8c643bfe55b7 171 *
jksoft 0:8c643bfe55b7 172 * @details This initialization will return a UART user id for the caller. The UART user id must be
jksoft 0:8c643bfe55b7 173 * used upon re-initialization of the UART or closing of the module for the user.
jksoft 0:8c643bfe55b7 174 * If single instance usage is needed, the APP_UART_INIT() macro should be used instead.
jksoft 0:8c643bfe55b7 175 *
jksoft 0:8c643bfe55b7 176 * @note Normally single instance initialization should be done using the APP_UART_INIT() or
jksoft 0:8c643bfe55b7 177 * APP_UART_INIT_FIFO() macro depending on whether the FIFO should be used by the UART, as
jksoft 0:8c643bfe55b7 178 * that will allocate the buffers needed by the UART module (including aligning the buffer
jksoft 0:8c643bfe55b7 179 * correctly).
jksoft 0:8c643bfe55b7 180
jksoft 0:8c643bfe55b7 181 * @param[in] p_comm_params Pin and communication parameters.
jksoft 0:8c643bfe55b7 182 * @param[in] p_buffers RX and TX buffers, NULL is FIFO is not used.
jksoft 0:8c643bfe55b7 183 * @param[in] error_handler Function to be called in case of an error.
jksoft 0:8c643bfe55b7 184 * @param[in] app_irq_priority Interrupt priority level.
jksoft 0:8c643bfe55b7 185 * @param[in,out] p_uart_uid User id for the UART module. The p_uart_uid must be used if
jksoft 0:8c643bfe55b7 186 * re-initialization and/or closing of the UART module is needed.
jksoft 0:8c643bfe55b7 187 * If the value pointed to by p_uart_uid is zero, this is
jksoft 0:8c643bfe55b7 188 * considdered a first time initialization. Otherwise this is
jksoft 0:8c643bfe55b7 189 * considered a re-initialization for the user with id *p_uart_uid.
jksoft 0:8c643bfe55b7 190 *
jksoft 0:8c643bfe55b7 191 * @retval NRF_SUCCESS If successful initialization.
jksoft 0:8c643bfe55b7 192 * @retval NRF_ERROR_INVALID_LENGTH If a provided buffer is not a power of two.
jksoft 0:8c643bfe55b7 193 * @retval NRF_ERROR_NULL If one of the provided buffers is a NULL pointer.
jksoft 0:8c643bfe55b7 194 *
jksoft 0:8c643bfe55b7 195 * Those errors are propagated by the UART module to the caller upon registration when Hardware Flow
jksoft 0:8c643bfe55b7 196 * Control is enabled. When Hardware Flow Control is not used, those errors cannot occur.
jksoft 0:8c643bfe55b7 197 * @retval NRF_ERROR_INVALID_STATE The GPIOTE module is not in a valid state when registering
jksoft 0:8c643bfe55b7 198 * the UART module as a user.
jksoft 0:8c643bfe55b7 199 * @retval NRF_ERROR_INVALID_PARAM The UART module provides an invalid callback function when
jksoft 0:8c643bfe55b7 200 * registering the UART module as a user.
jksoft 0:8c643bfe55b7 201 * Or the value pointed to by *p_uart_uid is not a valid
jksoft 0:8c643bfe55b7 202 * GPIOTE number.
jksoft 0:8c643bfe55b7 203 * @retval NRF_ERROR_NO_MEM GPIOTE module has reached the maximum number of users.
jksoft 0:8c643bfe55b7 204 */
jksoft 0:8c643bfe55b7 205 uint32_t app_uart_init(const app_uart_comm_params_t * p_comm_params,
jksoft 0:8c643bfe55b7 206 app_uart_buffers_t * p_buffers,
jksoft 0:8c643bfe55b7 207 app_uart_event_handler_t error_handler,
jksoft 0:8c643bfe55b7 208 app_irq_priority_t irq_priority,
jksoft 0:8c643bfe55b7 209 uint16_t * p_uart_uid);
jksoft 0:8c643bfe55b7 210
jksoft 0:8c643bfe55b7 211 /**@brief Function for getting a byte from the UART.
jksoft 0:8c643bfe55b7 212 *
jksoft 0:8c643bfe55b7 213 * @details This function will get the next byte from the RX buffer. If the RX buffer is empty
jksoft 0:8c643bfe55b7 214 * an error code will be returned and the app_uart module will generate an event upon
jksoft 0:8c643bfe55b7 215 * reception of the first byte which is added to the RX buffer.
jksoft 0:8c643bfe55b7 216 *
jksoft 0:8c643bfe55b7 217 * @param[out] p_byte Pointer to an address where next byte received on the UART will be copied.
jksoft 0:8c643bfe55b7 218 *
jksoft 0:8c643bfe55b7 219 * @retval NRF_SUCCESS If a byte has been received and pushed to the pointer provided.
jksoft 0:8c643bfe55b7 220 * @retval NRF_ERROR_NOT_FOUND If no byte is available in the RX buffer of the app_uart module.
jksoft 0:8c643bfe55b7 221 */
jksoft 0:8c643bfe55b7 222 uint32_t app_uart_get(uint8_t * p_byte);
jksoft 0:8c643bfe55b7 223
jksoft 0:8c643bfe55b7 224 /**@brief Function for putting a byte on the UART.
jksoft 0:8c643bfe55b7 225 *
jksoft 0:8c643bfe55b7 226 * @details This call is non-blocking.
jksoft 0:8c643bfe55b7 227 *
jksoft 0:8c643bfe55b7 228 * @param[in] byte Byte to be transmitted on the UART.
jksoft 0:8c643bfe55b7 229 *
jksoft 0:8c643bfe55b7 230 * @retval NRF_SUCCESS If the byte was succesfully put on the TX buffer for transmission.
jksoft 0:8c643bfe55b7 231 * @retval NRF_ERROR_NO_MEM If no more space is available in the TX buffer.
jksoft 0:8c643bfe55b7 232 * NRF_ERROR_NO_MEM may occur if flow control is enabled and CTS signal
jksoft 0:8c643bfe55b7 233 * is high for a long period and the buffer fills up.
jksoft 0:8c643bfe55b7 234 */
jksoft 0:8c643bfe55b7 235 uint32_t app_uart_put(uint8_t byte);
jksoft 0:8c643bfe55b7 236
jksoft 0:8c643bfe55b7 237 /**@brief Function for getting the current state of the UART.
jksoft 0:8c643bfe55b7 238 *
jksoft 0:8c643bfe55b7 239 * @details If flow control is disabled, the state is assumed to always be APP_UART_CONNECTED.
jksoft 0:8c643bfe55b7 240 *
jksoft 0:8c643bfe55b7 241 * When using flow control the state will be controlled by the CTS. If CTS is set active
jksoft 0:8c643bfe55b7 242 * by the remote side, or the app_uart module is in the process of transmitting a byte,
jksoft 0:8c643bfe55b7 243 * app_uart is in APP_UART_CONNECTED state. If CTS is set inactive by remote side app_uart
jksoft 0:8c643bfe55b7 244 * will not get into APP_UART_DISCONNECTED state until the last byte in the TXD register
jksoft 0:8c643bfe55b7 245 * is fully transmitted.
jksoft 0:8c643bfe55b7 246 *
jksoft 0:8c643bfe55b7 247 * Internal states in the state machine are mapped to the general connected/disconnected
jksoft 0:8c643bfe55b7 248 * states in the following ways:
jksoft 0:8c643bfe55b7 249 *
jksoft 0:8c643bfe55b7 250 * - UART_ON = CONNECTED
jksoft 0:8c643bfe55b7 251 * - UART_READY = CONNECTED
jksoft 0:8c643bfe55b7 252 * - UART_WAIT = CONNECTED
jksoft 0:8c643bfe55b7 253 * - UART_OFF = DISCONNECTED.
jksoft 0:8c643bfe55b7 254 *
jksoft 0:8c643bfe55b7 255 * @param[out] p_connection_state Current connection state of the UART.
jksoft 0:8c643bfe55b7 256 *
jksoft 0:8c643bfe55b7 257 * @retval NRF_SUCCESS The connection state was succesfully retrieved.
jksoft 0:8c643bfe55b7 258 */
jksoft 0:8c643bfe55b7 259 uint32_t app_uart_get_connection_state(app_uart_connection_state_t * p_connection_state);
jksoft 0:8c643bfe55b7 260
jksoft 0:8c643bfe55b7 261 /**@brief Function for flushing the RX and TX buffers (Only valid if FIFO is used).
jksoft 0:8c643bfe55b7 262 * This function does nothing if FIFO is not used.
jksoft 0:8c643bfe55b7 263 *
jksoft 0:8c643bfe55b7 264 * @retval NRF_SUCCESS Flushing completed (Current implementation will always succeed).
jksoft 0:8c643bfe55b7 265 */
jksoft 0:8c643bfe55b7 266 uint32_t app_uart_flush(void);
jksoft 0:8c643bfe55b7 267
jksoft 0:8c643bfe55b7 268 /**@brief Function for closing the UART module.
jksoft 0:8c643bfe55b7 269 *
jksoft 0:8c643bfe55b7 270 * @details This function will close any on-going UART transmissions and disable itself in the
jksoft 0:8c643bfe55b7 271 * GPTIO module.
jksoft 0:8c643bfe55b7 272 *
jksoft 0:8c643bfe55b7 273 * @param[in] app_uart_uid User id for the UART module. The app_uart_uid must be identical to the
jksoft 0:8c643bfe55b7 274 * UART id returned on initialization and which is currently in use.
jksoft 0:8c643bfe55b7 275
jksoft 0:8c643bfe55b7 276 * @retval NRF_SUCCESS If successfully closed.
jksoft 0:8c643bfe55b7 277 * @retval NRF_ERROR_INVALID_PARAM If an invalid user id is provided or the user id differs from
jksoft 0:8c643bfe55b7 278 * the current active user.
jksoft 0:8c643bfe55b7 279 */
jksoft 0:8c643bfe55b7 280 uint32_t app_uart_close(uint16_t app_uart_id);
jksoft 0:8c643bfe55b7 281
jksoft 0:8c643bfe55b7 282
jksoft 0:8c643bfe55b7 283 #endif // APP_UART_H__
jksoft 0:8c643bfe55b7 284
jksoft 0:8c643bfe55b7 285 /** @} */