mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
<>
Date:
Tue Nov 08 17:28:34 2016 +0000
Revision:
129:0ab6a29f35bf
Parent:
109:9296ab0bfc11
Child:
143:86740a56073b
Release 129 of the mbed library

Ports for Upcoming Targets

3011: Add u-blox Sara-N target. https://github.com/ARMmbed/mbed-os/pull/3011
3099: MAX32625 https://github.com/ARMmbed/mbed-os/pull/3099
3151: Add support for FRDM-K82F https://github.com/ARMmbed/mbed-os/pull/3151
3177: New mcu k22512 fixing pr 3136 https://github.com/ARMmbed/mbed-os/pull/3177

Fixes and Changes

3008: NUCLEO_F072RB: Fix wrong timer channel number on pwm PB_5 pin https://github.com/ARMmbed/mbed-os/pull/3008
3013: STM32xx - Change how the ADC internal pins are checked before pinmap_ https://github.com/ARMmbed/mbed-os/pull/3013
3041: [nRF5] - added implementation of API of serial port flow control configuration. https://github.com/ARMmbed/mbed-os/pull/3041
3084: [nrf5] fix in Digital I/O : a gpioe pin was uninitialized badly https://github.com/ARMmbed/mbed-os/pull/3084
3009: TRNG enabled. TRNG APIs implemented. REV A/B/C/D flags removed. Warnings removed https://github.com/ARMmbed/mbed-os/pull/3009
3074: Target stm init gcc alignement https://github.com/ARMmbed/mbed-os/pull/3074
2988: Update of can_api.c fixing #2987 https://github.com/ARMmbed/mbed-os/pull/2988
3173: [Exporters] Add a device_name to microbit entry in targets.json https://github.com/ARMmbed/mbed-os/pull/3173
2969: [nRF52] - switch irq priorities of driver handlers to the lowest level https://github.com/ARMmbed/mbed-os/pull/2969
3184: #3183 Compiler warning in trng_api.c with K64F https://github.com/ARMmbed/mbed-os/pull/3184
3104: [NuMaker] Support CAN and fix PWM CLK error https://github.com/ARMmbed/mbed-os/pull/3104
3186: MultiTech mDot - add back SPI3 pins https://github.com/ARMmbed/mbed-os/pull/3186
3075: nsapi - Add standardized return types for size and errors https://github.com/ARMmbed/mbed-os/pull/3075
3221: u-blox odin w2 drivers update https://github.com/ARMmbed/mbed-os/pull/3221

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 109:9296ab0bfc11 1 /**
Kojto 109:9296ab0bfc11 2 ******************************************************************************
Kojto 109:9296ab0bfc11 3 * @file
Kojto 109:9296ab0bfc11 4 * @author
Kojto 109:9296ab0bfc11 5 * @version
Kojto 109:9296ab0bfc11 6 * @date
Kojto 109:9296ab0bfc11 7 * @brief This file contains all the functions prototypes for the UART
Kojto 109:9296ab0bfc11 8 * firmware library.
Kojto 109:9296ab0bfc11 9 ******************************************************************************
Kojto 109:9296ab0bfc11 10 *
Kojto 109:9296ab0bfc11 11 ******************************************************************************
Kojto 109:9296ab0bfc11 12 */
Kojto 109:9296ab0bfc11 13
Kojto 109:9296ab0bfc11 14 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 109:9296ab0bfc11 15 #ifndef __W7500X_UART_H
Kojto 109:9296ab0bfc11 16 #define __W7500X_UART_H
Kojto 109:9296ab0bfc11 17
Kojto 109:9296ab0bfc11 18 #ifdef __cplusplus
Kojto 109:9296ab0bfc11 19 extern "C" {
Kojto 109:9296ab0bfc11 20 #endif
Kojto 109:9296ab0bfc11 21
Kojto 109:9296ab0bfc11 22 /* Includes ------------------------------------------------------------------*/
Kojto 109:9296ab0bfc11 23 #include "W7500x.h"
Kojto 109:9296ab0bfc11 24
Kojto 109:9296ab0bfc11 25
Kojto 109:9296ab0bfc11 26 /**
Kojto 109:9296ab0bfc11 27 * @brief UART Init Structure definition
Kojto 109:9296ab0bfc11 28 */
Kojto 109:9296ab0bfc11 29
Kojto 109:9296ab0bfc11 30 typedef struct
Kojto 109:9296ab0bfc11 31 {
Kojto 109:9296ab0bfc11 32 uint32_t UART_BaudRate;
Kojto 109:9296ab0bfc11 33 uint16_t UART_WordLength;
Kojto 109:9296ab0bfc11 34 uint16_t UART_StopBits;
Kojto 109:9296ab0bfc11 35 uint16_t UART_Parity;
Kojto 109:9296ab0bfc11 36 uint16_t UART_Mode;
Kojto 109:9296ab0bfc11 37 uint16_t UART_HardwareFlowControl;
Kojto 109:9296ab0bfc11 38 } UART_InitTypeDef;
Kojto 109:9296ab0bfc11 39
Kojto 109:9296ab0bfc11 40 /**
Kojto 109:9296ab0bfc11 41 * @}
Kojto 109:9296ab0bfc11 42 */
Kojto 109:9296ab0bfc11 43
Kojto 109:9296ab0bfc11 44
Kojto 109:9296ab0bfc11 45 /** @defgroup UART_Exported_Constants
Kojto 109:9296ab0bfc11 46 * @{
Kojto 109:9296ab0bfc11 47 */
Kojto 109:9296ab0bfc11 48
Kojto 109:9296ab0bfc11 49 #define IS_UART_01_PERIPH(PERIPH) (((PERIPH) == UART0) || ((PERIPH) == UART1))
Kojto 109:9296ab0bfc11 50 #define IS_UART_2_PERIPH(PERIPH) ((PERIPH) == UART2)
Kojto 109:9296ab0bfc11 51
Kojto 109:9296ab0bfc11 52 /**
Kojto 109:9296ab0bfc11 53 * @}
Kojto 109:9296ab0bfc11 54 */
Kojto 109:9296ab0bfc11 55
Kojto 109:9296ab0bfc11 56
Kojto 109:9296ab0bfc11 57
Kojto 109:9296ab0bfc11 58 /** @addtogroup UART_Word_Length
Kojto 109:9296ab0bfc11 59 * @{
Kojto 109:9296ab0bfc11 60 */
Kojto 109:9296ab0bfc11 61
Kojto 109:9296ab0bfc11 62 #define UART_WordLength_8b ((uint16_t)UART_LCR_H_WLEN(3))
Kojto 109:9296ab0bfc11 63 #define UART_WordLength_7b ((uint16_t)UART_LCR_H_WLEN(2))
Kojto 109:9296ab0bfc11 64 #define UART_WordLength_6b ((uint16_t)UART_LCR_H_WLEN(1))
Kojto 109:9296ab0bfc11 65 #define UART_WordLength_5b ((uint16_t)UART_LCR_H_WLEN(0))
Kojto 109:9296ab0bfc11 66 #define IS_UART_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WordLength_8b) || \
Kojto 109:9296ab0bfc11 67 ((LENGTH) == UART_WordLength_7b) || \
Kojto 109:9296ab0bfc11 68 ((LENGTH) == UART_WordLength_6b) || \
Kojto 109:9296ab0bfc11 69 ((LENGTH) == UART_WordLength_5b) )
Kojto 109:9296ab0bfc11 70 /**
Kojto 109:9296ab0bfc11 71 * @}
Kojto 109:9296ab0bfc11 72 */
Kojto 109:9296ab0bfc11 73
Kojto 109:9296ab0bfc11 74
Kojto 109:9296ab0bfc11 75 /** @addtogroup UART_Parity
Kojto 109:9296ab0bfc11 76 * @{
Kojto 109:9296ab0bfc11 77 */
Kojto 109:9296ab0bfc11 78
Kojto 109:9296ab0bfc11 79 #define UART_Parity_No ((uint16_t)0x0000)
Kojto 109:9296ab0bfc11 80 #define UART_Parity_Even ((uint16_t)(UART_LCR_H_PEN | UART_LCR_H_EPS))
Kojto 109:9296ab0bfc11 81 #define UART_Parity_Odd ((uint16_t)(UART_LCR_H_PEN))
Kojto 109:9296ab0bfc11 82 #define IS_UART_PARITY(PARITY) (((PARITY) == UART_Parity_No) || \
Kojto 109:9296ab0bfc11 83 ((PARITY) == UART_Parity_Even) || \
Kojto 109:9296ab0bfc11 84 ((PARITY) == UART_Parity_Odd))
Kojto 109:9296ab0bfc11 85
Kojto 109:9296ab0bfc11 86 /**
Kojto 109:9296ab0bfc11 87 * @}
Kojto 109:9296ab0bfc11 88 */
Kojto 109:9296ab0bfc11 89
Kojto 109:9296ab0bfc11 90
Kojto 109:9296ab0bfc11 91 /** @addtogroup UART_Stop_Bits
Kojto 109:9296ab0bfc11 92 * @{
Kojto 109:9296ab0bfc11 93 */
Kojto 109:9296ab0bfc11 94
Kojto 109:9296ab0bfc11 95 #define UART_StopBits_1 ((uint16_t)0x0000)
Kojto 109:9296ab0bfc11 96 #define UART_StopBits_2 ((uint16_t)(UART_LCR_H_STP2))
Kojto 109:9296ab0bfc11 97 #define IS_UART_STOPBITS(STOPBITS) (((STOPBITS) == UART_StopBits_1) || \
Kojto 109:9296ab0bfc11 98 ((STOPBITS) == UART_StopBits_2))
Kojto 109:9296ab0bfc11 99 /**
Kojto 109:9296ab0bfc11 100 * @}
Kojto 109:9296ab0bfc11 101 */
Kojto 109:9296ab0bfc11 102
Kojto 109:9296ab0bfc11 103
Kojto 109:9296ab0bfc11 104 /** @addtogroup UART_Mode
Kojto 109:9296ab0bfc11 105 * @{
Kojto 109:9296ab0bfc11 106 */
Kojto 109:9296ab0bfc11 107
Kojto 109:9296ab0bfc11 108 #define UART_Mode_Rx ((uint16_t)(UART_CR_RXE))
Kojto 109:9296ab0bfc11 109 #define UART_Mode_Tx ((uint16_t)(UART_CR_TXE))
Kojto 109:9296ab0bfc11 110 #define IS_UART_MODE(MODE) (((MODE) == UART_Mode_Rx) || \
Kojto 109:9296ab0bfc11 111 ((MODE) == UART_Mode_Tx))
Kojto 109:9296ab0bfc11 112
Kojto 109:9296ab0bfc11 113 /**
Kojto 109:9296ab0bfc11 114 * @}
Kojto 109:9296ab0bfc11 115 */
Kojto 109:9296ab0bfc11 116
Kojto 109:9296ab0bfc11 117
Kojto 109:9296ab0bfc11 118 /** @addtogroup UART_Hardware_Flow_Control
Kojto 109:9296ab0bfc11 119 * @{
Kojto 109:9296ab0bfc11 120 */
Kojto 109:9296ab0bfc11 121
Kojto 109:9296ab0bfc11 122 #define UART_HardwareFlowControl_None ((uint16_t)0x0000)
Kojto 109:9296ab0bfc11 123 #define UART_HardwareFlowControl_RTS ((uint16_t)UART_CR_RTSEn)
Kojto 109:9296ab0bfc11 124 #define UART_HardwareFlowControl_CTS ((uint16_t)UART_CR_CTSEn)
Kojto 109:9296ab0bfc11 125 #define UART_HardwareFlowControl_RTS_CTS ((uint16_t)(UART_CR_RTSEn | UART_CR_CTSEn))
Kojto 109:9296ab0bfc11 126 #define IS_UART_HARDWARE_FLOW_CONTROL(CONTROL) \
Kojto 109:9296ab0bfc11 127 (((CONTROL) == UART_HardwareFlowControl_None) || \
Kojto 109:9296ab0bfc11 128 ((CONTROL) == UART_HardwareFlowControl_RTS) || \
Kojto 109:9296ab0bfc11 129 ((CONTROL) == UART_HardwareFlowControl_CTS) || \
Kojto 109:9296ab0bfc11 130 ((CONTROL) == UART_HardwareFlowControl_RTS_CTS))
Kojto 109:9296ab0bfc11 131 /**
Kojto 109:9296ab0bfc11 132 * @}
Kojto 109:9296ab0bfc11 133 */
Kojto 109:9296ab0bfc11 134
Kojto 109:9296ab0bfc11 135
Kojto 109:9296ab0bfc11 136 /** @addtogroup UART_Receive Status
Kojto 109:9296ab0bfc11 137 * @{
Kojto 109:9296ab0bfc11 138 */
Kojto 109:9296ab0bfc11 139
Kojto 109:9296ab0bfc11 140 #define UART_RECV_STATUS_OE ((uint16_t)0x01UL << 3) /*!< Overrun error */
Kojto 109:9296ab0bfc11 141 #define UART_RECV_STATUS_BE ((uint16_t)0x01UL << 2) /*!< Break error */
Kojto 109:9296ab0bfc11 142 #define UART_RECV_STATUS_PE ((uint16_t)0x01UL << 1) /*!< Parity error */
Kojto 109:9296ab0bfc11 143 #define UART_RECV_STATUS_FE ((uint16_t)0x01UL << 0) /*!< Framing error */
Kojto 109:9296ab0bfc11 144 #define IS_UART_RECV_STATUS(FLAG) (((FLAG) == UART_RECV_STATUS_OE) || ((FLAG) == UART_RECV_STATUS_BE) || \
Kojto 109:9296ab0bfc11 145 ((FLAG) == UART_RECV_STATUS_PE) || ((FLAG) == UART_RECV_STATUS_FE))
Kojto 109:9296ab0bfc11 146 /**
Kojto 109:9296ab0bfc11 147 * @}
Kojto 109:9296ab0bfc11 148 */
Kojto 109:9296ab0bfc11 149
Kojto 109:9296ab0bfc11 150
Kojto 109:9296ab0bfc11 151
Kojto 109:9296ab0bfc11 152 /** @addtogroup UART_Flags
Kojto 109:9296ab0bfc11 153 * @{
Kojto 109:9296ab0bfc11 154 */
Kojto 109:9296ab0bfc11 155
Kojto 109:9296ab0bfc11 156 #define UART_FLAG_RI ((uint16_t)0x01UL << 8) /*!< Ring indicator */
Kojto 109:9296ab0bfc11 157 #define UART_FLAG_TXFE ((uint16_t)0x01UL << 7) /*!< Transmit FIFO empty */
Kojto 109:9296ab0bfc11 158 #define UART_FLAG_RXFF ((uint16_t)0x01UL << 6) /*!< Receive FIFO full */
Kojto 109:9296ab0bfc11 159 #define UART_FLAG_TXFF ((uint16_t)0x01UL << 5) /*!< Transmit FIFO full */
Kojto 109:9296ab0bfc11 160 #define UART_FLAG_RXFE ((uint16_t)0x01UL << 4) /*!< Receive FIFO empty */
Kojto 109:9296ab0bfc11 161 #define UART_FLAG_BUSY ((uint16_t)0x01UL << 3) /*!< UART busy */
Kojto 109:9296ab0bfc11 162 #define UART_FLAG_DCD ((uint16_t)0x01UL << 2) /*!< Data carrier detect */
Kojto 109:9296ab0bfc11 163 #define UART_FLAG_DSR ((uint16_t)0x01UL << 1) /*!< Data set ready */
Kojto 109:9296ab0bfc11 164 #define UART_FLAG_CTS ((uint16_t)0x01UL << 0) /*!< Clear to send */
Kojto 109:9296ab0bfc11 165 #define IS_UART_FLAG(FLAG) (((FLAG) == UART_FLAG_RI) || ((FLAG) == UART_FLAG_TXFE) || \
Kojto 109:9296ab0bfc11 166 ((FLAG) == UART_FLAG_RXFF) || ((FLAG) == UART_FLAG_TXFF) || \
Kojto 109:9296ab0bfc11 167 ((FLAG) == UART_FLAG_RXFE) || ((FLAG) == UART_FLAG_BUSY) || \
Kojto 109:9296ab0bfc11 168 ((FLAG) == UART_FLAG_DCD) || ((FLAG) == UART_FLAG_DSR) || \
Kojto 109:9296ab0bfc11 169 ((FLAG) == UART_FLAG_CTS))
Kojto 109:9296ab0bfc11 170
Kojto 109:9296ab0bfc11 171 /**
Kojto 109:9296ab0bfc11 172 * @}
Kojto 109:9296ab0bfc11 173 */
Kojto 109:9296ab0bfc11 174
Kojto 109:9296ab0bfc11 175
Kojto 109:9296ab0bfc11 176 /** @addtogroup UART_IT_Flags
Kojto 109:9296ab0bfc11 177 * @{
Kojto 109:9296ab0bfc11 178 */
Kojto 109:9296ab0bfc11 179
Kojto 109:9296ab0bfc11 180 #define UART_IT_FLAG_OEI ((uint16_t)0x01UL << 10) /*!< Overrun error interrupt */
Kojto 109:9296ab0bfc11 181 #define UART_IT_FLAG_BEI ((uint16_t)0x01UL << 9) /*!< Break error interrupt */
Kojto 109:9296ab0bfc11 182 #define UART_IT_FLAG_PEI ((uint16_t)0x01UL << 8) /*!< Parity error interrupt */
Kojto 109:9296ab0bfc11 183 #define UART_IT_FLAG_FEI ((uint16_t)0x01UL << 7) /*!< Framing error interrupt */
Kojto 109:9296ab0bfc11 184 #define UART_IT_FLAG_RTI ((uint16_t)0x01UL << 6) /*!< Receive timeout interrupt */
Kojto 109:9296ab0bfc11 185 #define UART_IT_FLAG_TXI ((uint16_t)0x01UL << 5) /*!< Transmit interrupt */
Kojto 109:9296ab0bfc11 186 #define UART_IT_FLAG_RXI ((uint16_t)0x01UL << 4) /*!< Receive interrupt */
Kojto 109:9296ab0bfc11 187 #define UART_IT_FLAG_DSRMI ((uint16_t)0x01UL << 3) /*!< UARTDSR modem interrupt */
Kojto 109:9296ab0bfc11 188 #define UART_IT_FLAG_DCDMI ((uint16_t)0x01UL << 2) /*!< UARTDCD modem interrupt */
Kojto 109:9296ab0bfc11 189 #define UART_IT_FLAG_CTSMI ((uint16_t)0x01UL << 1) /*!< UARTCTS modem interrupt */
Kojto 109:9296ab0bfc11 190 #define UART_IT_FLAG_RIMI ((uint16_t)0x01UL << 0) /*!< UARTRI modem interrupt */
Kojto 109:9296ab0bfc11 191 #define IS_UART_IT_FLAG(FLAG) (((FLAG) == UART_IT_FLAG_OEI) || ((FLAG) == UART_IT_FLAG_BEI) || \
Kojto 109:9296ab0bfc11 192 ((FLAG) == UART_IT_FLAG_PEI) || ((FLAG) == UART_IT_FLAG_FEI) || \
Kojto 109:9296ab0bfc11 193 ((FLAG) == UART_IT_FLAG_RTI) || ((FLAG) == UART_IT_FLAG_TXI) || \
Kojto 109:9296ab0bfc11 194 ((FLAG) == UART_IT_FLAG_RXI) || ((FLAG) == UART_IT_FLAG_DSRMI) || \
Kojto 109:9296ab0bfc11 195 ((FLAG) == UART_IT_FLAG_DCDMI)|| ((FLAG) == UART_IT_FLAG_CTSMI) || \
Kojto 109:9296ab0bfc11 196 ((FLAG) == UART_IT_FLAG_RIMI))
Kojto 109:9296ab0bfc11 197 /**
Kojto 109:9296ab0bfc11 198 * @}
Kojto 109:9296ab0bfc11 199 */
Kojto 109:9296ab0bfc11 200 /** @addtogroup UART_FIFO_Level Select
Kojto 109:9296ab0bfc11 201 * @{
Kojto 109:9296ab0bfc11 202 */
Kojto 109:9296ab0bfc11 203
Kojto 109:9296ab0bfc11 204 #define UART_IFLS_RXIFLSEL7_8 ((uint16_t)(UART_IFLS_RXIFLSEL(4)))
Kojto 109:9296ab0bfc11 205 #define UART_IFLS_RXIFLSEL3_4 ((uint16_t)(UART_IFLS_RXIFLSEL(3)))
Kojto 109:9296ab0bfc11 206 #define UART_IFLS_RXIFLSEL1_2 ((uint16_t)(UART_IFLS_RXIFLSEL(2)))
Kojto 109:9296ab0bfc11 207 #define UART_IFLS_RXIFLSEL1_4 ((uint16_t)(UART_IFLS_RXIFLSEL(1)))
Kojto 109:9296ab0bfc11 208 #define UART_IFLS_RXIFLSEL1_8 ((uint16_t)(UART_IFLS_RXIFLSEL(0)))
Kojto 109:9296ab0bfc11 209 #define UART_IFLS_TXIFLSEL7_8 ((uint16_t)(UART_IFLS_TXIFLSEL(4)))
Kojto 109:9296ab0bfc11 210 #define UART_IFLS_TXIFLSEL3_4 ((uint16_t)(UART_IFLS_TXIFLSEL(3)))
Kojto 109:9296ab0bfc11 211 #define UART_IFLS_TXIFLSEL1_2 ((uint16_t)(UART_IFLS_TXIFLSEL(2)))
Kojto 109:9296ab0bfc11 212 #define UART_IFLS_TXIFLSEL1_4 ((uint16_t)(UART_IFLS_TXIFLSEL(1)))
Kojto 109:9296ab0bfc11 213 #define UART_IFLS_TXIFLSEL1_8 ((uint16_t)(UART_IFLS_TXIFLSEL(0)))
Kojto 109:9296ab0bfc11 214
Kojto 109:9296ab0bfc11 215 #define IS_UART_FIFO_Level(FLAG) (((FLAG) == UART_IFLS_RXIFLSEL7_8) || ((FLAG) == UART_IFLS_RXIFLSEL3_4)|| \
Kojto 109:9296ab0bfc11 216 ((FLAG) == UART_IFLS_RXIFLSEL1_2)|| ((FLAG) == UART_IFLS_RXIFLSEL1_4)|| ((FLAG) == UART_IFLS_RXIFLSEL1_8)||\
Kojto 109:9296ab0bfc11 217 ((FLAG) == UART_IFLS_TXIFLSEL7_8)|| ((FLAG) == UART_IFLS_TXIFLSEL3_4)|| \
Kojto 109:9296ab0bfc11 218 ((FLAG) == UART_IFLS_TXIFLSEL1_2)|| ((FLAG) == UART_IFLS_TXIFLSEL1_4)||((FLAG) == UART_IFLS_TXIFLSEL1_8))
Kojto 109:9296ab0bfc11 219
Kojto 109:9296ab0bfc11 220 /**
Kojto 109:9296ab0bfc11 221 * @}
Kojto 109:9296ab0bfc11 222 */
Kojto 109:9296ab0bfc11 223
Kojto 109:9296ab0bfc11 224 /** @addtogroup S_UART_Flags
Kojto 109:9296ab0bfc11 225 * @{
Kojto 109:9296ab0bfc11 226 */
Kojto 109:9296ab0bfc11 227 #define S_UART_STATE_RXO ((uint16_t)0x01UL << 3) /*!< RX buffer Overrun */
Kojto 109:9296ab0bfc11 228 #define S_UART_STATE_TXO ((uint16_t)0x01UL << 2) /*!< TX buffer Overrun */
Kojto 109:9296ab0bfc11 229 #define S_UART_STATE_RXF ((uint16_t)0x01UL << 1) /*!< RX buffer Full */
Kojto 109:9296ab0bfc11 230 #define S_UART_STATE_TXF ((uint16_t)0x01UL << 0) /*!< TX buffer Full */
Kojto 109:9296ab0bfc11 231 #define IS_S_UART_STATE(FLAG) (((FLAG) == S_UART_STATE_RXO) || ((FLAG) == S_UART_STATE_TXO) || \
Kojto 109:9296ab0bfc11 232 ((FLAG) == S_UART_STATE_RXF) || ((FLAG) == S_UART_STATE_TXF))
Kojto 109:9296ab0bfc11 233 /**
Kojto 109:9296ab0bfc11 234 * @}
Kojto 109:9296ab0bfc11 235 */
Kojto 109:9296ab0bfc11 236
Kojto 109:9296ab0bfc11 237
Kojto 109:9296ab0bfc11 238 /** @addtogroup S_UART_CTRL_Flags
Kojto 109:9296ab0bfc11 239 * @{
Kojto 109:9296ab0bfc11 240 */
Kojto 109:9296ab0bfc11 241
Kojto 109:9296ab0bfc11 242 #define S_UART_CTRL_RXOI ((uint16_t)0x01UL << 5) /*!< RX overrun interrupt */
Kojto 109:9296ab0bfc11 243 #define S_UART_CTRL_TXOI ((uint16_t)0x01UL << 4) /*!< TX overrun interrupt */
Kojto 109:9296ab0bfc11 244 #define S_UART_CTRL_RXI ((uint16_t)0x01UL << 3) /*!< RX interrupt */
Kojto 109:9296ab0bfc11 245 #define S_UART_CTRL_TXI ((uint16_t)0x01UL << 2) /*!< TX interrupt */
Kojto 109:9296ab0bfc11 246 #define S_UART_CTRL_RX ((uint16_t)0x01UL << 1) /*!< RX */
Kojto 109:9296ab0bfc11 247 #define S_UART_CTRL_TX ((uint16_t)0x01UL << 0) /*!< TX */
Kojto 109:9296ab0bfc11 248
Kojto 109:9296ab0bfc11 249
Kojto 109:9296ab0bfc11 250 #define IS_S_UART_CTRL_FLAG(FLAG) (((FLAG) == S_UART_CTRL_FLAG_RXOI) || ((FLAG) == S_UART_CTRL_FLAG_TXOI) || \
Kojto 109:9296ab0bfc11 251 ((FLAG) == S_UART_CTRL_FLAG_RXI) || ((FLAG) == S_UART_CTRL_FLAG_TXI) || \
Kojto 109:9296ab0bfc11 252 ((FLAG) == S_UART_CTRL_FLAG_RX) || ((FLAG) == S_UART_CTRL_FLAG_TX))
Kojto 109:9296ab0bfc11 253 /**
Kojto 109:9296ab0bfc11 254 * @}
Kojto 109:9296ab0bfc11 255 */
Kojto 109:9296ab0bfc11 256
Kojto 109:9296ab0bfc11 257
Kojto 109:9296ab0bfc11 258 /** @addtogroup S_UART_IT_Flags
Kojto 109:9296ab0bfc11 259 * @{
Kojto 109:9296ab0bfc11 260 */
Kojto 109:9296ab0bfc11 261
Kojto 109:9296ab0bfc11 262 #define S_UART_INTSTATUS_RXOI ((uint16_t)0x01UL << 3) /*!< RX overrun interrupt */
Kojto 109:9296ab0bfc11 263 #define S_UART_INTSTATUS_TXOI ((uint16_t)0x01UL << 2) /*!< TX overrun interrupt */
Kojto 109:9296ab0bfc11 264 #define S_UART_INTSTATUS_RXI ((uint16_t)0x01UL << 1) /*!< RX interrupt */
Kojto 109:9296ab0bfc11 265 #define S_UART_INTSTATUS_TXI ((uint16_t)0x01UL << 0) /*!< TX interrupt */
Kojto 109:9296ab0bfc11 266 #define IS_S_UART_INTSTATUS(FLAG) (((FLAG) == S_UART_INTSTATUS_RXOI) || ((FLAG) == S_UART_INTSTATUS_TXOI) || \
Kojto 109:9296ab0bfc11 267 ((FLAG) == S_UART_INTSTATUS_RXI) || ((FLAG) == S_UART_INTSTATUS_TXI))
Kojto 109:9296ab0bfc11 268 /**
Kojto 109:9296ab0bfc11 269 * @}
Kojto 109:9296ab0bfc11 270 */
Kojto 109:9296ab0bfc11 271
Kojto 109:9296ab0bfc11 272
Kojto 109:9296ab0bfc11 273 void UART_StructInit (UART_InitTypeDef* UART_InitStruct);
Kojto 109:9296ab0bfc11 274
Kojto 109:9296ab0bfc11 275 uint32_t UART_Init (UART_TypeDef *UARTx, UART_InitTypeDef* UART_InitStruct);
Kojto 109:9296ab0bfc11 276 void UART_SendData (UART_TypeDef* UARTx, uint16_t Data);
Kojto 109:9296ab0bfc11 277 uint16_t UART_ReceiveData (UART_TypeDef* UARTx);
Kojto 109:9296ab0bfc11 278 void UART_SendBreak (UART_TypeDef* UARTx);
Kojto 109:9296ab0bfc11 279 void UART_ClearRecvStatus (UART_TypeDef* UARTx, uint16_t UART_RECV_STATUS);
Kojto 109:9296ab0bfc11 280 FlagStatus UART_GetFlagStatus (UART_TypeDef* UARTx, uint16_t UART_FLAG);
Kojto 109:9296ab0bfc11 281 void UART_ITConfig (UART_TypeDef* UARTx, uint16_t UART_IT, FunctionalState NewState);
Kojto 109:9296ab0bfc11 282 ITStatus UART_GetITStatus (UART_TypeDef* UARTx, uint16_t UART_IT);
Kojto 109:9296ab0bfc11 283 void UART_ClearITPendingBit (UART_TypeDef* UARTx, uint16_t UART_IT);
Kojto 109:9296ab0bfc11 284
Kojto 109:9296ab0bfc11 285 uint8_t UartPutc (UART_TypeDef* UARTx, uint8_t ch);
Kojto 109:9296ab0bfc11 286 void UartPuts (UART_TypeDef* UARTx, uint8_t *str);
Kojto 109:9296ab0bfc11 287 uint8_t UartGetc (UART_TypeDef* UARTx);
Kojto 109:9296ab0bfc11 288
Kojto 109:9296ab0bfc11 289 void S_UART_DeInit (void);
Kojto 109:9296ab0bfc11 290 uint32_t S_UART_Init (uint32_t baud);
Kojto 109:9296ab0bfc11 291 void S_UART_SetBaud (uint32_t baud);
Kojto 109:9296ab0bfc11 292 void S_UART_SetCTRL (uint16_t S_UART_CTRL, FunctionalState NewState);
Kojto 109:9296ab0bfc11 293 void S_UART_SendData (uint16_t Data);
Kojto 109:9296ab0bfc11 294 uint16_t S_UART_ReceiveData(void);
Kojto 109:9296ab0bfc11 295
Kojto 109:9296ab0bfc11 296 uint8_t S_UartPutc (uint8_t ch);
Kojto 109:9296ab0bfc11 297 void S_UartPuts (uint8_t *str);
Kojto 109:9296ab0bfc11 298 uint8_t S_UartGetc (void);
Kojto 109:9296ab0bfc11 299
Kojto 109:9296ab0bfc11 300 FlagStatus S_UART_GetFlagStatus (uint16_t S_UART_STATE);
Kojto 109:9296ab0bfc11 301 void S_UART_ITConfig (uint16_t S_UART_CTRL, FunctionalState NewState);
Kojto 109:9296ab0bfc11 302
Kojto 109:9296ab0bfc11 303 ITStatus S_UART_GetITStatus (uint16_t S_UART_IT);
Kojto 109:9296ab0bfc11 304 void S_UART_ClearITPendingBit(uint16_t S_UART_IT);
Kojto 109:9296ab0bfc11 305
Kojto 109:9296ab0bfc11 306
Kojto 109:9296ab0bfc11 307 #ifdef __cplusplus
Kojto 109:9296ab0bfc11 308 }
Kojto 109:9296ab0bfc11 309 #endif
Kojto 109:9296ab0bfc11 310
Kojto 109:9296ab0bfc11 311
Kojto 109:9296ab0bfc11 312 #endif // __W7500X_UART_H
Kojto 109:9296ab0bfc11 313