The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_TY51822R3/TOOLCHAIN_IAR/nrf_uart.h@172:65be27845400, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 20:53:29 2019 +0000
- Revision:
- 172:65be27845400
- Parent:
- 171:3a7713b1edbc
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 143:86740a56073b | 1 | /* |
AnnaBridge | 143:86740a56073b | 2 | * Copyright (c) 2015 Nordic Semiconductor ASA |
AnnaBridge | 143:86740a56073b | 3 | * All rights reserved. |
AnnaBridge | 143:86740a56073b | 4 | * |
AnnaBridge | 143:86740a56073b | 5 | * Redistribution and use in source and binary forms, with or without modification, |
AnnaBridge | 143:86740a56073b | 6 | * are permitted provided that the following conditions are met: |
AnnaBridge | 143:86740a56073b | 7 | * |
AnnaBridge | 143:86740a56073b | 8 | * 1. Redistributions of source code must retain the above copyright notice, this list |
AnnaBridge | 143:86740a56073b | 9 | * of conditions and the following disclaimer. |
AnnaBridge | 143:86740a56073b | 10 | * |
AnnaBridge | 143:86740a56073b | 11 | * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
AnnaBridge | 143:86740a56073b | 12 | * integrated circuit in a product or a software update for such product, must reproduce |
AnnaBridge | 143:86740a56073b | 13 | * the above copyright notice, this list of conditions and the following disclaimer in |
AnnaBridge | 143:86740a56073b | 14 | * the documentation and/or other materials provided with the distribution. |
AnnaBridge | 143:86740a56073b | 15 | * |
AnnaBridge | 143:86740a56073b | 16 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
AnnaBridge | 143:86740a56073b | 17 | * used to endorse or promote products derived from this software without specific prior |
AnnaBridge | 143:86740a56073b | 18 | * written permission. |
AnnaBridge | 143:86740a56073b | 19 | * |
AnnaBridge | 143:86740a56073b | 20 | * 4. This software, with or without modification, must only be used with a |
AnnaBridge | 143:86740a56073b | 21 | * Nordic Semiconductor ASA integrated circuit. |
AnnaBridge | 143:86740a56073b | 22 | * |
AnnaBridge | 143:86740a56073b | 23 | * 5. Any software provided in binary or object form under this license must not be reverse |
AnnaBridge | 143:86740a56073b | 24 | * engineered, decompiled, modified and/or disassembled. |
AnnaBridge | 143:86740a56073b | 25 | * |
AnnaBridge | 143:86740a56073b | 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
AnnaBridge | 143:86740a56073b | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
AnnaBridge | 143:86740a56073b | 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 143:86740a56073b | 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
AnnaBridge | 143:86740a56073b | 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
AnnaBridge | 143:86740a56073b | 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
AnnaBridge | 143:86740a56073b | 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
AnnaBridge | 143:86740a56073b | 33 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
AnnaBridge | 143:86740a56073b | 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
AnnaBridge | 143:86740a56073b | 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 143:86740a56073b | 36 | * |
AnnaBridge | 143:86740a56073b | 37 | */ |
AnnaBridge | 143:86740a56073b | 38 | |
AnnaBridge | 143:86740a56073b | 39 | #ifndef NRF_UART_H__ |
AnnaBridge | 143:86740a56073b | 40 | #define NRF_UART_H__ |
AnnaBridge | 143:86740a56073b | 41 | |
AnnaBridge | 143:86740a56073b | 42 | #include "nrf.h" |
AnnaBridge | 143:86740a56073b | 43 | #include <stdint.h> |
AnnaBridge | 143:86740a56073b | 44 | #include <stddef.h> |
AnnaBridge | 143:86740a56073b | 45 | #include <stdbool.h> |
AnnaBridge | 143:86740a56073b | 46 | |
AnnaBridge | 143:86740a56073b | 47 | /** |
AnnaBridge | 143:86740a56073b | 48 | * @defgroup nrf_uart_hal UART HAL |
AnnaBridge | 143:86740a56073b | 49 | * @{ |
AnnaBridge | 143:86740a56073b | 50 | * @ingroup nrf_uart |
AnnaBridge | 143:86740a56073b | 51 | * |
AnnaBridge | 143:86740a56073b | 52 | * @brief Hardware access layer for accessing the UART peripheral. |
AnnaBridge | 143:86740a56073b | 53 | */ |
AnnaBridge | 143:86740a56073b | 54 | |
AnnaBridge | 143:86740a56073b | 55 | #define NRF_UART_PSEL_DISCONNECTED 0xFFFFFFFF |
AnnaBridge | 143:86740a56073b | 56 | |
AnnaBridge | 143:86740a56073b | 57 | /** |
AnnaBridge | 143:86740a56073b | 58 | * @enum nrf_uart_task_t |
AnnaBridge | 143:86740a56073b | 59 | * @brief UART tasks. |
AnnaBridge | 143:86740a56073b | 60 | */ |
AnnaBridge | 143:86740a56073b | 61 | typedef enum |
AnnaBridge | 143:86740a56073b | 62 | { |
AnnaBridge | 143:86740a56073b | 63 | /*lint -save -e30 -esym(628,__INTADDR__)*/ |
AnnaBridge | 143:86740a56073b | 64 | NRF_UART_TASK_STARTRX = offsetof(NRF_UART_Type, TASKS_STARTRX), /**< Task for starting reception. */ |
AnnaBridge | 143:86740a56073b | 65 | NRF_UART_TASK_STOPRX = offsetof(NRF_UART_Type, TASKS_STOPRX), /**< Task for stopping reception. */ |
AnnaBridge | 143:86740a56073b | 66 | NRF_UART_TASK_STARTTX = offsetof(NRF_UART_Type, TASKS_STARTTX), /**< Task for starting transmission. */ |
AnnaBridge | 143:86740a56073b | 67 | NRF_UART_TASK_STOPTX = offsetof(NRF_UART_Type, TASKS_STOPTX), /**< Task for stopping transmission. */ |
AnnaBridge | 143:86740a56073b | 68 | NRF_UART_TASK_SUSPEND = offsetof(NRF_UART_Type, TASKS_SUSPEND), /**< Task for suspending UART. */ |
AnnaBridge | 143:86740a56073b | 69 | /*lint -restore*/ |
AnnaBridge | 143:86740a56073b | 70 | } nrf_uart_task_t; |
AnnaBridge | 143:86740a56073b | 71 | |
AnnaBridge | 143:86740a56073b | 72 | /** |
AnnaBridge | 143:86740a56073b | 73 | * @enum nrf_uart_event_t |
AnnaBridge | 143:86740a56073b | 74 | * @brief UART events. |
AnnaBridge | 143:86740a56073b | 75 | */ |
AnnaBridge | 143:86740a56073b | 76 | typedef enum |
AnnaBridge | 143:86740a56073b | 77 | { |
AnnaBridge | 143:86740a56073b | 78 | /*lint -save -e30*/ |
AnnaBridge | 143:86740a56073b | 79 | NRF_UART_EVENT_CTS = offsetof(NRF_UART_Type, EVENTS_CTS), /**< Event from CTS line activation. */ |
AnnaBridge | 143:86740a56073b | 80 | NRF_UART_EVENT_NCTS = offsetof(NRF_UART_Type, EVENTS_NCTS), /**< Event from CTS line deactivation. */ |
AnnaBridge | 143:86740a56073b | 81 | NRF_UART_EVENT_RXDRDY = offsetof(NRF_UART_Type, EVENTS_RXDRDY),/**< Event from data ready in RXD. */ |
AnnaBridge | 143:86740a56073b | 82 | NRF_UART_EVENT_TXDRDY = offsetof(NRF_UART_Type, EVENTS_TXDRDY),/**< Event from data sent from TXD. */ |
AnnaBridge | 143:86740a56073b | 83 | NRF_UART_EVENT_ERROR = offsetof(NRF_UART_Type, EVENTS_ERROR), /**< Event from error detection. */ |
AnnaBridge | 143:86740a56073b | 84 | NRF_UART_EVENT_RXTO = offsetof(NRF_UART_Type, EVENTS_RXTO) /**< Event from receiver timeout. */ |
AnnaBridge | 143:86740a56073b | 85 | /*lint -restore*/ |
AnnaBridge | 143:86740a56073b | 86 | } nrf_uart_event_t; |
AnnaBridge | 143:86740a56073b | 87 | |
AnnaBridge | 143:86740a56073b | 88 | /** |
AnnaBridge | 143:86740a56073b | 89 | * @enum nrf_uart_int_mask_t |
AnnaBridge | 143:86740a56073b | 90 | * @brief UART interrupts. |
AnnaBridge | 143:86740a56073b | 91 | */ |
AnnaBridge | 143:86740a56073b | 92 | typedef enum |
AnnaBridge | 143:86740a56073b | 93 | { |
AnnaBridge | 143:86740a56073b | 94 | /*lint -save -e30*/ |
AnnaBridge | 143:86740a56073b | 95 | NRF_UART_INT_MASK_CTS = UART_INTENCLR_CTS_Msk, /**< CTS line activation interrupt. */ |
AnnaBridge | 143:86740a56073b | 96 | NRF_UART_INT_MASK_NCTS = UART_INTENCLR_NCTS_Msk, /**< CTS line deactivation interrupt. */ |
AnnaBridge | 143:86740a56073b | 97 | NRF_UART_INT_MASK_RXDRDY = UART_INTENCLR_RXDRDY_Msk, /**< Data ready in RXD interrupt. */ |
AnnaBridge | 143:86740a56073b | 98 | NRF_UART_INT_MASK_TXDRDY = UART_INTENCLR_TXDRDY_Msk, /**< Data sent from TXD interrupt. */ |
AnnaBridge | 143:86740a56073b | 99 | NRF_UART_INT_MASK_ERROR = UART_INTENCLR_ERROR_Msk, /**< Error detection interrupt. */ |
AnnaBridge | 143:86740a56073b | 100 | NRF_UART_INT_MASK_RXTO = UART_INTENCLR_RXTO_Msk /**< Receiver timeout interrupt. */ |
AnnaBridge | 143:86740a56073b | 101 | /*lint -restore*/ |
AnnaBridge | 143:86740a56073b | 102 | } nrf_uart_int_mask_t; |
AnnaBridge | 143:86740a56073b | 103 | |
AnnaBridge | 143:86740a56073b | 104 | /** |
AnnaBridge | 143:86740a56073b | 105 | * @enum nrf_uart_baudrate_t |
AnnaBridge | 143:86740a56073b | 106 | * @brief Baudrates supported by UART. |
AnnaBridge | 143:86740a56073b | 107 | */ |
AnnaBridge | 143:86740a56073b | 108 | typedef enum |
AnnaBridge | 143:86740a56073b | 109 | { |
AnnaBridge | 143:86740a56073b | 110 | #ifdef NRF52 |
AnnaBridge | 143:86740a56073b | 111 | NRF_UART_BAUDRATE_1200 = UARTE_BAUDRATE_BAUDRATE_Baud1200, /**< 1200 baud. */ |
AnnaBridge | 143:86740a56073b | 112 | NRF_UART_BAUDRATE_2400 = UARTE_BAUDRATE_BAUDRATE_Baud2400, /**< 2400 baud. */ |
AnnaBridge | 143:86740a56073b | 113 | NRF_UART_BAUDRATE_4800 = UARTE_BAUDRATE_BAUDRATE_Baud4800, /**< 4800 baud. */ |
AnnaBridge | 143:86740a56073b | 114 | NRF_UART_BAUDRATE_9600 = UARTE_BAUDRATE_BAUDRATE_Baud9600, /**< 9600 baud. */ |
AnnaBridge | 143:86740a56073b | 115 | NRF_UART_BAUDRATE_14400 = UARTE_BAUDRATE_BAUDRATE_Baud14400, /**< 14400 baud. */ |
AnnaBridge | 143:86740a56073b | 116 | NRF_UART_BAUDRATE_19200 = UARTE_BAUDRATE_BAUDRATE_Baud19200, /**< 19200 baud. */ |
AnnaBridge | 143:86740a56073b | 117 | NRF_UART_BAUDRATE_28800 = UARTE_BAUDRATE_BAUDRATE_Baud28800, /**< 28800 baud. */ |
AnnaBridge | 143:86740a56073b | 118 | NRF_UART_BAUDRATE_38400 = UARTE_BAUDRATE_BAUDRATE_Baud38400, /**< 38400 baud. */ |
AnnaBridge | 143:86740a56073b | 119 | NRF_UART_BAUDRATE_57600 = UARTE_BAUDRATE_BAUDRATE_Baud57600, /**< 57600 baud. */ |
AnnaBridge | 143:86740a56073b | 120 | NRF_UART_BAUDRATE_76800 = UARTE_BAUDRATE_BAUDRATE_Baud76800, /**< 76800 baud. */ |
AnnaBridge | 143:86740a56073b | 121 | NRF_UART_BAUDRATE_115200 = UARTE_BAUDRATE_BAUDRATE_Baud115200, /**< 115200 baud. */ |
AnnaBridge | 143:86740a56073b | 122 | NRF_UART_BAUDRATE_230400 = UARTE_BAUDRATE_BAUDRATE_Baud230400, /**< 230400 baud. */ |
AnnaBridge | 143:86740a56073b | 123 | NRF_UART_BAUDRATE_250000 = UARTE_BAUDRATE_BAUDRATE_Baud250000, /**< 250000 baud. */ |
AnnaBridge | 143:86740a56073b | 124 | NRF_UART_BAUDRATE_460800 = UARTE_BAUDRATE_BAUDRATE_Baud460800, /**< 460800 baud. */ |
AnnaBridge | 143:86740a56073b | 125 | NRF_UART_BAUDRATE_921600 = UARTE_BAUDRATE_BAUDRATE_Baud921600, /**< 921600 baud. */ |
AnnaBridge | 143:86740a56073b | 126 | NRF_UART_BAUDRATE_1000000 = UARTE_BAUDRATE_BAUDRATE_Baud1M, /**< 1000000 baud. */ |
AnnaBridge | 143:86740a56073b | 127 | #else |
AnnaBridge | 143:86740a56073b | 128 | NRF_UART_BAUDRATE_1200 = UART_BAUDRATE_BAUDRATE_Baud1200, /**< 1200 baud. */ |
AnnaBridge | 143:86740a56073b | 129 | NRF_UART_BAUDRATE_2400 = UART_BAUDRATE_BAUDRATE_Baud2400, /**< 2400 baud. */ |
AnnaBridge | 143:86740a56073b | 130 | NRF_UART_BAUDRATE_4800 = UART_BAUDRATE_BAUDRATE_Baud4800, /**< 4800 baud. */ |
AnnaBridge | 143:86740a56073b | 131 | NRF_UART_BAUDRATE_9600 = UART_BAUDRATE_BAUDRATE_Baud9600, /**< 9600 baud. */ |
AnnaBridge | 143:86740a56073b | 132 | NRF_UART_BAUDRATE_14400 = UART_BAUDRATE_BAUDRATE_Baud14400, /**< 14400 baud. */ |
AnnaBridge | 143:86740a56073b | 133 | NRF_UART_BAUDRATE_19200 = UART_BAUDRATE_BAUDRATE_Baud19200, /**< 19200 baud. */ |
AnnaBridge | 143:86740a56073b | 134 | NRF_UART_BAUDRATE_28800 = UART_BAUDRATE_BAUDRATE_Baud28800, /**< 28800 baud. */ |
AnnaBridge | 143:86740a56073b | 135 | NRF_UART_BAUDRATE_38400 = UART_BAUDRATE_BAUDRATE_Baud38400, /**< 38400 baud. */ |
AnnaBridge | 143:86740a56073b | 136 | NRF_UART_BAUDRATE_57600 = UART_BAUDRATE_BAUDRATE_Baud57600, /**< 57600 baud. */ |
AnnaBridge | 143:86740a56073b | 137 | NRF_UART_BAUDRATE_76800 = UART_BAUDRATE_BAUDRATE_Baud76800, /**< 76800 baud. */ |
AnnaBridge | 143:86740a56073b | 138 | NRF_UART_BAUDRATE_115200 = UART_BAUDRATE_BAUDRATE_Baud115200, /**< 115200 baud. */ |
AnnaBridge | 143:86740a56073b | 139 | NRF_UART_BAUDRATE_230400 = UART_BAUDRATE_BAUDRATE_Baud230400, /**< 230400 baud. */ |
AnnaBridge | 143:86740a56073b | 140 | NRF_UART_BAUDRATE_250000 = UART_BAUDRATE_BAUDRATE_Baud250000, /**< 250000 baud. */ |
AnnaBridge | 143:86740a56073b | 141 | NRF_UART_BAUDRATE_460800 = UART_BAUDRATE_BAUDRATE_Baud460800, /**< 460800 baud. */ |
AnnaBridge | 143:86740a56073b | 142 | NRF_UART_BAUDRATE_921600 = UART_BAUDRATE_BAUDRATE_Baud921600, /**< 921600 baud. */ |
AnnaBridge | 143:86740a56073b | 143 | NRF_UART_BAUDRATE_1000000 = UART_BAUDRATE_BAUDRATE_Baud1M, /**< 1000000 baud. */ |
AnnaBridge | 143:86740a56073b | 144 | #endif |
AnnaBridge | 143:86740a56073b | 145 | } nrf_uart_baudrate_t; |
AnnaBridge | 143:86740a56073b | 146 | |
AnnaBridge | 143:86740a56073b | 147 | /** |
AnnaBridge | 143:86740a56073b | 148 | * @enum nrf_uart_error_mask_t |
AnnaBridge | 143:86740a56073b | 149 | * @brief Types of UART error masks. |
AnnaBridge | 143:86740a56073b | 150 | */ |
AnnaBridge | 143:86740a56073b | 151 | typedef enum |
AnnaBridge | 143:86740a56073b | 152 | { |
AnnaBridge | 143:86740a56073b | 153 | NRF_UART_ERROR_OVERRUN_MASK = UART_ERRORSRC_OVERRUN_Msk, /**< Overrun error. */ |
AnnaBridge | 143:86740a56073b | 154 | NRF_UART_ERROR_PARITY_MASK = UART_ERRORSRC_PARITY_Msk, /**< Parity error. */ |
AnnaBridge | 143:86740a56073b | 155 | NRF_UART_ERROR_FRAMING_MASK = UART_ERRORSRC_FRAMING_Msk, /**< Framing error. */ |
AnnaBridge | 143:86740a56073b | 156 | NRF_UART_ERROR_BREAK_MASK = UART_ERRORSRC_BREAK_Msk, /**< Break error. */ |
AnnaBridge | 143:86740a56073b | 157 | } nrf_uart_error_mask_t; |
AnnaBridge | 143:86740a56073b | 158 | |
AnnaBridge | 143:86740a56073b | 159 | /** |
AnnaBridge | 143:86740a56073b | 160 | * @enum nrf_uart_parity_t |
AnnaBridge | 143:86740a56073b | 161 | * @brief Types of UART parity modes. |
AnnaBridge | 143:86740a56073b | 162 | */ |
AnnaBridge | 143:86740a56073b | 163 | typedef enum |
AnnaBridge | 143:86740a56073b | 164 | { |
AnnaBridge | 143:86740a56073b | 165 | NRF_UART_PARITY_EXCLUDED = UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos, /**< Parity excluded. */ |
AnnaBridge | 143:86740a56073b | 166 | NRF_UART_PARITY_INCLUDED = UART_CONFIG_PARITY_Included << UART_CONFIG_PARITY_Pos, /**< Parity included. */ |
AnnaBridge | 143:86740a56073b | 167 | } nrf_uart_parity_t; |
AnnaBridge | 143:86740a56073b | 168 | |
AnnaBridge | 143:86740a56073b | 169 | /** |
AnnaBridge | 143:86740a56073b | 170 | * @enum nrf_uart_hwfc_t |
AnnaBridge | 143:86740a56073b | 171 | * @brief Types of UART flow control modes. |
AnnaBridge | 143:86740a56073b | 172 | */ |
AnnaBridge | 143:86740a56073b | 173 | typedef enum |
AnnaBridge | 143:86740a56073b | 174 | { |
AnnaBridge | 143:86740a56073b | 175 | NRF_UART_HWFC_DISABLED = UART_CONFIG_HWFC_Disabled, /**< HW flow control disabled. */ |
AnnaBridge | 143:86740a56073b | 176 | NRF_UART_HWFC_ENABLED = UART_CONFIG_HWFC_Enabled, /**< HW flow control enabled. */ |
AnnaBridge | 143:86740a56073b | 177 | } nrf_uart_hwfc_t; |
AnnaBridge | 143:86740a56073b | 178 | |
AnnaBridge | 143:86740a56073b | 179 | /** |
AnnaBridge | 143:86740a56073b | 180 | * @brief Function for clearing a specific UART event. |
AnnaBridge | 143:86740a56073b | 181 | * |
AnnaBridge | 143:86740a56073b | 182 | * @param[in] p_reg UART instance. |
AnnaBridge | 143:86740a56073b | 183 | * @param[in] event Event to clear. |
AnnaBridge | 143:86740a56073b | 184 | */ |
AnnaBridge | 143:86740a56073b | 185 | __STATIC_INLINE void nrf_uart_event_clear(NRF_UART_Type * p_reg, nrf_uart_event_t event); |
AnnaBridge | 143:86740a56073b | 186 | |
AnnaBridge | 143:86740a56073b | 187 | /** |
AnnaBridge | 143:86740a56073b | 188 | * @brief Function for checking the state of a specific UART event. |
AnnaBridge | 143:86740a56073b | 189 | * |
AnnaBridge | 143:86740a56073b | 190 | * @param[in] p_reg UART instance. |
AnnaBridge | 143:86740a56073b | 191 | * @param[in] event Event to check. |
AnnaBridge | 143:86740a56073b | 192 | * |
AnnaBridge | 143:86740a56073b | 193 | * @retval True if event is set, False otherwise. |
AnnaBridge | 143:86740a56073b | 194 | */ |
AnnaBridge | 143:86740a56073b | 195 | __STATIC_INLINE bool nrf_uart_event_check(NRF_UART_Type * p_reg, nrf_uart_event_t event); |
AnnaBridge | 143:86740a56073b | 196 | |
AnnaBridge | 143:86740a56073b | 197 | /** |
AnnaBridge | 143:86740a56073b | 198 | * @brief Function for returning the address of a specific UART event register. |
AnnaBridge | 143:86740a56073b | 199 | * |
AnnaBridge | 143:86740a56073b | 200 | * @param[in] p_reg UART instance. |
AnnaBridge | 143:86740a56073b | 201 | * @param[in] event Desired event. |
AnnaBridge | 143:86740a56073b | 202 | * |
AnnaBridge | 143:86740a56073b | 203 | * @retval Address of specified event register. |
AnnaBridge | 143:86740a56073b | 204 | */ |
AnnaBridge | 143:86740a56073b | 205 | __STATIC_INLINE uint32_t nrf_uart_event_address_get(NRF_UART_Type * p_reg, |
AnnaBridge | 143:86740a56073b | 206 | nrf_uart_event_t event); |
AnnaBridge | 143:86740a56073b | 207 | |
AnnaBridge | 143:86740a56073b | 208 | /** |
AnnaBridge | 143:86740a56073b | 209 | * @brief Function for enabling a specific interrupt. |
AnnaBridge | 143:86740a56073b | 210 | * |
AnnaBridge | 143:86740a56073b | 211 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 212 | * @param int_mask Interrupts to enable. |
AnnaBridge | 143:86740a56073b | 213 | */ |
AnnaBridge | 143:86740a56073b | 214 | __STATIC_INLINE void nrf_uart_int_enable(NRF_UART_Type * p_reg, uint32_t int_mask); |
AnnaBridge | 143:86740a56073b | 215 | |
AnnaBridge | 143:86740a56073b | 216 | /** |
AnnaBridge | 143:86740a56073b | 217 | * @brief Function for retrieving the state of a given interrupt. |
AnnaBridge | 143:86740a56073b | 218 | * |
AnnaBridge | 143:86740a56073b | 219 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 220 | * @param int_mask Mask of interrupt to check. |
AnnaBridge | 143:86740a56073b | 221 | * |
AnnaBridge | 143:86740a56073b | 222 | * @retval true If the interrupt is enabled. |
AnnaBridge | 143:86740a56073b | 223 | * @retval false If the interrupt is not enabled. |
AnnaBridge | 143:86740a56073b | 224 | */ |
AnnaBridge | 143:86740a56073b | 225 | __STATIC_INLINE bool nrf_uart_int_enable_check(NRF_UART_Type * p_reg, uint32_t int_mask); |
AnnaBridge | 143:86740a56073b | 226 | |
AnnaBridge | 143:86740a56073b | 227 | /** |
AnnaBridge | 143:86740a56073b | 228 | * @brief Function for disabling specific interrupts. |
AnnaBridge | 143:86740a56073b | 229 | * |
AnnaBridge | 143:86740a56073b | 230 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 231 | * @param int_mask Interrupts to disable. |
AnnaBridge | 143:86740a56073b | 232 | */ |
AnnaBridge | 143:86740a56073b | 233 | __STATIC_INLINE void nrf_uart_int_disable(NRF_UART_Type * p_reg, uint32_t int_mask); |
AnnaBridge | 143:86740a56073b | 234 | |
AnnaBridge | 143:86740a56073b | 235 | /** |
AnnaBridge | 143:86740a56073b | 236 | * @brief Function for getting error source mask. Function is clearing error source flags after reading. |
AnnaBridge | 143:86740a56073b | 237 | * |
AnnaBridge | 143:86740a56073b | 238 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 239 | * @return Mask with error source flags. |
AnnaBridge | 143:86740a56073b | 240 | */ |
AnnaBridge | 143:86740a56073b | 241 | __STATIC_INLINE uint32_t nrf_uart_errorsrc_get_and_clear(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 242 | |
AnnaBridge | 143:86740a56073b | 243 | /** |
AnnaBridge | 143:86740a56073b | 244 | * @brief Function for enabling UART. |
AnnaBridge | 143:86740a56073b | 245 | * |
AnnaBridge | 143:86740a56073b | 246 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 247 | */ |
AnnaBridge | 143:86740a56073b | 248 | __STATIC_INLINE void nrf_uart_enable(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 249 | |
AnnaBridge | 143:86740a56073b | 250 | /** |
AnnaBridge | 143:86740a56073b | 251 | * @brief Function for disabling UART. |
AnnaBridge | 143:86740a56073b | 252 | * |
AnnaBridge | 143:86740a56073b | 253 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 254 | */ |
AnnaBridge | 143:86740a56073b | 255 | __STATIC_INLINE void nrf_uart_disable(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 256 | |
AnnaBridge | 143:86740a56073b | 257 | /** |
AnnaBridge | 143:86740a56073b | 258 | * @brief Function for configuring TX/RX pins. |
AnnaBridge | 143:86740a56073b | 259 | * |
AnnaBridge | 143:86740a56073b | 260 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 261 | * @param pseltxd TXD pin number. |
AnnaBridge | 143:86740a56073b | 262 | * @param pselrxd RXD pin number. |
AnnaBridge | 143:86740a56073b | 263 | */ |
AnnaBridge | 143:86740a56073b | 264 | __STATIC_INLINE void nrf_uart_txrx_pins_set(NRF_UART_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd); |
AnnaBridge | 143:86740a56073b | 265 | |
AnnaBridge | 143:86740a56073b | 266 | /** |
AnnaBridge | 143:86740a56073b | 267 | * @brief Function for disconnecting TX/RX pins. |
AnnaBridge | 143:86740a56073b | 268 | * |
AnnaBridge | 143:86740a56073b | 269 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 270 | */ |
AnnaBridge | 143:86740a56073b | 271 | __STATIC_INLINE void nrf_uart_txrx_pins_disconnect(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 272 | |
AnnaBridge | 143:86740a56073b | 273 | /** |
AnnaBridge | 143:86740a56073b | 274 | * @brief Function for getting TX pin. |
AnnaBridge | 143:86740a56073b | 275 | * |
AnnaBridge | 143:86740a56073b | 276 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 277 | */ |
AnnaBridge | 143:86740a56073b | 278 | __STATIC_INLINE uint32_t nrf_uart_tx_pin_get(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 279 | |
AnnaBridge | 143:86740a56073b | 280 | /** |
AnnaBridge | 143:86740a56073b | 281 | * @brief Function for getting RX pin. |
AnnaBridge | 143:86740a56073b | 282 | * |
AnnaBridge | 143:86740a56073b | 283 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 284 | */ |
AnnaBridge | 143:86740a56073b | 285 | __STATIC_INLINE uint32_t nrf_uart_rx_pin_get(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 286 | |
AnnaBridge | 143:86740a56073b | 287 | /** |
AnnaBridge | 143:86740a56073b | 288 | * @brief Function for getting RTS pin. |
AnnaBridge | 143:86740a56073b | 289 | * |
AnnaBridge | 143:86740a56073b | 290 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 291 | */ |
AnnaBridge | 143:86740a56073b | 292 | __STATIC_INLINE uint32_t nrf_uart_rts_pin_get(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 293 | |
AnnaBridge | 143:86740a56073b | 294 | /** |
AnnaBridge | 143:86740a56073b | 295 | * @brief Function for getting CTS pin. |
AnnaBridge | 143:86740a56073b | 296 | * |
AnnaBridge | 143:86740a56073b | 297 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 298 | */ |
AnnaBridge | 143:86740a56073b | 299 | __STATIC_INLINE uint32_t nrf_uart_cts_pin_get(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 300 | |
AnnaBridge | 143:86740a56073b | 301 | |
AnnaBridge | 143:86740a56073b | 302 | /** |
AnnaBridge | 143:86740a56073b | 303 | * @brief Function for configuring flow control pins. |
AnnaBridge | 143:86740a56073b | 304 | * |
AnnaBridge | 143:86740a56073b | 305 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 306 | * @param pselrts RTS pin number. |
AnnaBridge | 143:86740a56073b | 307 | * @param pselcts CTS pin number. |
AnnaBridge | 143:86740a56073b | 308 | */ |
AnnaBridge | 143:86740a56073b | 309 | __STATIC_INLINE void nrf_uart_hwfc_pins_set(NRF_UART_Type * p_reg, |
AnnaBridge | 143:86740a56073b | 310 | uint32_t pselrts, |
AnnaBridge | 143:86740a56073b | 311 | uint32_t pselcts); |
AnnaBridge | 143:86740a56073b | 312 | |
AnnaBridge | 143:86740a56073b | 313 | /** |
AnnaBridge | 143:86740a56073b | 314 | * @brief Function for disconnecting flow control pins. |
AnnaBridge | 143:86740a56073b | 315 | * |
AnnaBridge | 143:86740a56073b | 316 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 317 | */ |
AnnaBridge | 143:86740a56073b | 318 | __STATIC_INLINE void nrf_uart_hwfc_pins_disconnect(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 319 | |
AnnaBridge | 143:86740a56073b | 320 | /** |
AnnaBridge | 143:86740a56073b | 321 | * @brief Function for reading RX data. |
AnnaBridge | 143:86740a56073b | 322 | * |
AnnaBridge | 143:86740a56073b | 323 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 324 | * @return Received byte. |
AnnaBridge | 143:86740a56073b | 325 | */ |
AnnaBridge | 143:86740a56073b | 326 | __STATIC_INLINE uint8_t nrf_uart_rxd_get(NRF_UART_Type * p_reg); |
AnnaBridge | 143:86740a56073b | 327 | |
AnnaBridge | 143:86740a56073b | 328 | /** |
AnnaBridge | 143:86740a56073b | 329 | * @brief Function for setting Tx data. |
AnnaBridge | 143:86740a56073b | 330 | * |
AnnaBridge | 143:86740a56073b | 331 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 332 | * @param txd Byte. |
AnnaBridge | 143:86740a56073b | 333 | */ |
AnnaBridge | 143:86740a56073b | 334 | __STATIC_INLINE void nrf_uart_txd_set(NRF_UART_Type * p_reg, uint8_t txd); |
AnnaBridge | 143:86740a56073b | 335 | |
AnnaBridge | 143:86740a56073b | 336 | /** |
AnnaBridge | 143:86740a56073b | 337 | * @brief Function for starting an UART task. |
AnnaBridge | 143:86740a56073b | 338 | * |
AnnaBridge | 143:86740a56073b | 339 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 340 | * @param task Task. |
AnnaBridge | 143:86740a56073b | 341 | */ |
AnnaBridge | 143:86740a56073b | 342 | __STATIC_INLINE void nrf_uart_task_trigger(NRF_UART_Type * p_reg, nrf_uart_task_t task); |
AnnaBridge | 143:86740a56073b | 343 | |
AnnaBridge | 143:86740a56073b | 344 | /** |
AnnaBridge | 143:86740a56073b | 345 | * @brief Function for returning the address of a specific task register. |
AnnaBridge | 143:86740a56073b | 346 | * |
AnnaBridge | 143:86740a56073b | 347 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 348 | * @param task Task. |
AnnaBridge | 143:86740a56073b | 349 | * |
AnnaBridge | 143:86740a56073b | 350 | * @return Task address. |
AnnaBridge | 143:86740a56073b | 351 | */ |
AnnaBridge | 143:86740a56073b | 352 | __STATIC_INLINE uint32_t nrf_uart_task_address_get(NRF_UART_Type * p_reg, nrf_uart_task_t task); |
AnnaBridge | 143:86740a56073b | 353 | |
AnnaBridge | 143:86740a56073b | 354 | /** |
AnnaBridge | 143:86740a56073b | 355 | * @brief Function for configuring UART. |
AnnaBridge | 143:86740a56073b | 356 | * |
AnnaBridge | 143:86740a56073b | 357 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 358 | * @param hwfc Hardware flow control. Enabled if true. |
AnnaBridge | 143:86740a56073b | 359 | * @param parity Parity. Included if true. |
AnnaBridge | 143:86740a56073b | 360 | */ |
AnnaBridge | 143:86740a56073b | 361 | __STATIC_INLINE void nrf_uart_configure(NRF_UART_Type * p_reg, |
AnnaBridge | 143:86740a56073b | 362 | nrf_uart_parity_t parity, |
AnnaBridge | 143:86740a56073b | 363 | nrf_uart_hwfc_t hwfc); |
AnnaBridge | 143:86740a56073b | 364 | |
AnnaBridge | 143:86740a56073b | 365 | /** |
AnnaBridge | 143:86740a56073b | 366 | * @brief Function for setting UART baudrate. |
AnnaBridge | 143:86740a56073b | 367 | * |
AnnaBridge | 143:86740a56073b | 368 | * @param p_reg Instance. |
AnnaBridge | 143:86740a56073b | 369 | * @param baudrate Baudrate. |
AnnaBridge | 143:86740a56073b | 370 | */ |
AnnaBridge | 143:86740a56073b | 371 | __STATIC_INLINE void nrf_uart_baudrate_set(NRF_UART_Type * p_reg, nrf_uart_baudrate_t baudrate); |
AnnaBridge | 143:86740a56073b | 372 | |
AnnaBridge | 143:86740a56073b | 373 | #ifndef SUPPRESS_INLINE_IMPLEMENTATION |
AnnaBridge | 143:86740a56073b | 374 | __STATIC_INLINE void nrf_uart_event_clear(NRF_UART_Type * p_reg, nrf_uart_event_t event) |
AnnaBridge | 143:86740a56073b | 375 | { |
AnnaBridge | 143:86740a56073b | 376 | *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL; |
AnnaBridge | 143:86740a56073b | 377 | |
AnnaBridge | 143:86740a56073b | 378 | } |
AnnaBridge | 143:86740a56073b | 379 | |
AnnaBridge | 143:86740a56073b | 380 | __STATIC_INLINE bool nrf_uart_event_check(NRF_UART_Type * p_reg, nrf_uart_event_t event) |
AnnaBridge | 143:86740a56073b | 381 | { |
AnnaBridge | 143:86740a56073b | 382 | return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event); |
AnnaBridge | 143:86740a56073b | 383 | } |
AnnaBridge | 143:86740a56073b | 384 | |
AnnaBridge | 143:86740a56073b | 385 | __STATIC_INLINE uint32_t nrf_uart_event_address_get(NRF_UART_Type * p_reg, |
AnnaBridge | 143:86740a56073b | 386 | nrf_uart_event_t event) |
AnnaBridge | 143:86740a56073b | 387 | { |
AnnaBridge | 143:86740a56073b | 388 | return (uint32_t)((uint8_t *)p_reg + (uint32_t)event); |
AnnaBridge | 143:86740a56073b | 389 | } |
AnnaBridge | 143:86740a56073b | 390 | |
AnnaBridge | 143:86740a56073b | 391 | __STATIC_INLINE void nrf_uart_int_enable(NRF_UART_Type * p_reg, uint32_t int_mask) |
AnnaBridge | 143:86740a56073b | 392 | { |
AnnaBridge | 143:86740a56073b | 393 | p_reg->INTENSET = int_mask; |
AnnaBridge | 143:86740a56073b | 394 | } |
AnnaBridge | 143:86740a56073b | 395 | |
AnnaBridge | 143:86740a56073b | 396 | __STATIC_INLINE bool nrf_uart_int_enable_check(NRF_UART_Type * p_reg, uint32_t int_mask) |
AnnaBridge | 143:86740a56073b | 397 | { |
AnnaBridge | 143:86740a56073b | 398 | return (bool)(p_reg->INTENSET & int_mask); |
AnnaBridge | 143:86740a56073b | 399 | } |
AnnaBridge | 143:86740a56073b | 400 | |
AnnaBridge | 143:86740a56073b | 401 | __STATIC_INLINE void nrf_uart_int_disable(NRF_UART_Type * p_reg, uint32_t int_mask) |
AnnaBridge | 143:86740a56073b | 402 | { |
AnnaBridge | 143:86740a56073b | 403 | p_reg->INTENCLR = int_mask; |
AnnaBridge | 143:86740a56073b | 404 | } |
AnnaBridge | 143:86740a56073b | 405 | |
AnnaBridge | 143:86740a56073b | 406 | __STATIC_INLINE uint32_t nrf_uart_errorsrc_get_and_clear(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 407 | { |
AnnaBridge | 143:86740a56073b | 408 | uint32_t errsrc_mask = p_reg->ERRORSRC; |
AnnaBridge | 143:86740a56073b | 409 | p_reg->ERRORSRC = errsrc_mask; |
AnnaBridge | 143:86740a56073b | 410 | return errsrc_mask; |
AnnaBridge | 143:86740a56073b | 411 | } |
AnnaBridge | 143:86740a56073b | 412 | |
AnnaBridge | 143:86740a56073b | 413 | __STATIC_INLINE void nrf_uart_enable(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 414 | { |
AnnaBridge | 143:86740a56073b | 415 | p_reg->ENABLE = UART_ENABLE_ENABLE_Enabled; |
AnnaBridge | 143:86740a56073b | 416 | } |
AnnaBridge | 143:86740a56073b | 417 | |
AnnaBridge | 143:86740a56073b | 418 | __STATIC_INLINE void nrf_uart_disable(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 419 | { |
AnnaBridge | 143:86740a56073b | 420 | p_reg->ENABLE = UART_ENABLE_ENABLE_Disabled; |
AnnaBridge | 143:86740a56073b | 421 | } |
AnnaBridge | 143:86740a56073b | 422 | |
AnnaBridge | 143:86740a56073b | 423 | __STATIC_INLINE void nrf_uart_txrx_pins_set(NRF_UART_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd) |
AnnaBridge | 143:86740a56073b | 424 | { |
AnnaBridge | 143:86740a56073b | 425 | p_reg->PSELTXD = pseltxd; |
AnnaBridge | 143:86740a56073b | 426 | p_reg->PSELRXD = pselrxd; |
AnnaBridge | 143:86740a56073b | 427 | } |
AnnaBridge | 143:86740a56073b | 428 | |
AnnaBridge | 143:86740a56073b | 429 | __STATIC_INLINE void nrf_uart_txrx_pins_disconnect(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 430 | { |
AnnaBridge | 143:86740a56073b | 431 | nrf_uart_txrx_pins_set(p_reg, NRF_UART_PSEL_DISCONNECTED, NRF_UART_PSEL_DISCONNECTED); |
AnnaBridge | 143:86740a56073b | 432 | } |
AnnaBridge | 143:86740a56073b | 433 | |
AnnaBridge | 143:86740a56073b | 434 | __STATIC_INLINE uint32_t nrf_uart_tx_pin_get(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 435 | { |
AnnaBridge | 143:86740a56073b | 436 | return p_reg->PSELTXD; |
AnnaBridge | 143:86740a56073b | 437 | } |
AnnaBridge | 143:86740a56073b | 438 | |
AnnaBridge | 143:86740a56073b | 439 | __STATIC_INLINE uint32_t nrf_uart_rx_pin_get(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 440 | { |
AnnaBridge | 143:86740a56073b | 441 | return p_reg->PSELRXD; |
AnnaBridge | 143:86740a56073b | 442 | } |
AnnaBridge | 143:86740a56073b | 443 | |
AnnaBridge | 143:86740a56073b | 444 | __STATIC_INLINE uint32_t nrf_uart_rts_pin_get(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 445 | { |
AnnaBridge | 143:86740a56073b | 446 | return p_reg->PSELRTS; |
AnnaBridge | 143:86740a56073b | 447 | } |
AnnaBridge | 143:86740a56073b | 448 | |
AnnaBridge | 143:86740a56073b | 449 | __STATIC_INLINE uint32_t nrf_uart_cts_pin_get(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 450 | { |
AnnaBridge | 143:86740a56073b | 451 | return p_reg->PSELCTS; |
AnnaBridge | 143:86740a56073b | 452 | } |
AnnaBridge | 143:86740a56073b | 453 | |
AnnaBridge | 143:86740a56073b | 454 | __STATIC_INLINE void nrf_uart_hwfc_pins_set(NRF_UART_Type * p_reg, uint32_t pselrts, uint32_t pselcts) |
AnnaBridge | 143:86740a56073b | 455 | { |
AnnaBridge | 143:86740a56073b | 456 | p_reg->PSELRTS = pselrts; |
AnnaBridge | 143:86740a56073b | 457 | p_reg->PSELCTS = pselcts; |
AnnaBridge | 143:86740a56073b | 458 | } |
AnnaBridge | 143:86740a56073b | 459 | |
AnnaBridge | 143:86740a56073b | 460 | __STATIC_INLINE void nrf_uart_hwfc_pins_disconnect(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 461 | { |
AnnaBridge | 143:86740a56073b | 462 | nrf_uart_hwfc_pins_set(p_reg, NRF_UART_PSEL_DISCONNECTED, NRF_UART_PSEL_DISCONNECTED); |
AnnaBridge | 143:86740a56073b | 463 | } |
AnnaBridge | 143:86740a56073b | 464 | |
AnnaBridge | 143:86740a56073b | 465 | __STATIC_INLINE uint8_t nrf_uart_rxd_get(NRF_UART_Type * p_reg) |
AnnaBridge | 143:86740a56073b | 466 | { |
AnnaBridge | 143:86740a56073b | 467 | return p_reg->RXD; |
AnnaBridge | 143:86740a56073b | 468 | } |
AnnaBridge | 143:86740a56073b | 469 | |
AnnaBridge | 143:86740a56073b | 470 | __STATIC_INLINE void nrf_uart_txd_set(NRF_UART_Type * p_reg, uint8_t txd) |
AnnaBridge | 143:86740a56073b | 471 | { |
AnnaBridge | 143:86740a56073b | 472 | p_reg->TXD = txd; |
AnnaBridge | 143:86740a56073b | 473 | } |
AnnaBridge | 143:86740a56073b | 474 | |
AnnaBridge | 143:86740a56073b | 475 | __STATIC_INLINE void nrf_uart_task_trigger(NRF_UART_Type * p_reg, nrf_uart_task_t task) |
AnnaBridge | 143:86740a56073b | 476 | { |
AnnaBridge | 143:86740a56073b | 477 | *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL; |
AnnaBridge | 143:86740a56073b | 478 | } |
AnnaBridge | 143:86740a56073b | 479 | |
AnnaBridge | 143:86740a56073b | 480 | __STATIC_INLINE uint32_t nrf_uart_task_address_get(NRF_UART_Type * p_reg, nrf_uart_task_t task) |
AnnaBridge | 143:86740a56073b | 481 | { |
AnnaBridge | 143:86740a56073b | 482 | return (uint32_t)p_reg + (uint32_t)task; |
AnnaBridge | 143:86740a56073b | 483 | } |
AnnaBridge | 143:86740a56073b | 484 | |
AnnaBridge | 143:86740a56073b | 485 | __STATIC_INLINE void nrf_uart_configure(NRF_UART_Type * p_reg, |
AnnaBridge | 143:86740a56073b | 486 | nrf_uart_parity_t parity, |
AnnaBridge | 143:86740a56073b | 487 | nrf_uart_hwfc_t hwfc) |
AnnaBridge | 143:86740a56073b | 488 | { |
AnnaBridge | 143:86740a56073b | 489 | p_reg->CONFIG = (uint32_t)parity | (uint32_t)hwfc; |
AnnaBridge | 143:86740a56073b | 490 | } |
AnnaBridge | 143:86740a56073b | 491 | |
AnnaBridge | 143:86740a56073b | 492 | __STATIC_INLINE void nrf_uart_baudrate_set(NRF_UART_Type * p_reg, nrf_uart_baudrate_t baudrate) |
AnnaBridge | 143:86740a56073b | 493 | { |
AnnaBridge | 143:86740a56073b | 494 | p_reg->BAUDRATE = baudrate; |
AnnaBridge | 143:86740a56073b | 495 | } |
AnnaBridge | 143:86740a56073b | 496 | #endif //SUPPRESS_INLINE_IMPLEMENTATION |
AnnaBridge | 143:86740a56073b | 497 | /** @} */ |
AnnaBridge | 143:86740a56073b | 498 | #endif //NRF_UART_H__ |