| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
IP: USART2 register block and driver
IP drivers: Common drivers used on multiple NXP devices

## Detailed Description

## Data Structures
struct | IP_USART_002_T
| USART2 register block structure. More...

## Macros
#define | RXRDY_INT (0x01 << 0)
#define | TXRDY_INT (0x01 << 2)
#define | CTS_DELTA_INT (0x01 << 5)
#define | TXINT_DIS_INT (0x01 << 6)
#define | OVRN_ERR_INT (0x01 << 8)
#define | DELTA_RXBRK_INT (0x01 << 11)
#define | START_DETECT_INT (0x01 << 12)
#define | FRM_ERR_INT (0x01 << 13)
#define | PAR_ERR_INT (0x01 << 14)
#define | RXNOISE_INT (0x01 << 15)
#define | RXRDY (0x01 << 0)
#define | RXIDLE (0x01 << 1)
#define | TXRDY (0x01 << 2)
#define | TXIDLE (0x01 << 3)
#define | CTS (0x01 << 4)
#define | CTS_DELTA (0x01 << 5)
#define | TXINT_DIS (0x01 << 6)
#define | OVRN_ERR (0x01 << 8)
#define | RXBRK (0x01 << 10)
#define | DELTA_RXBRK (0x01 << 11)
#define | START_DETECT (0x01 << 12)
#define | FRM_ERR (0x01 << 13)
#define | PAR_ERR (0x01 << 14)
#define | RXNOISE (0x01 << 15)
#define | UART_002_SYNCEN(n) ((n) == ENABLE ? (1 << 11) : 0)
#define | UART_002_ENABLE (1UL)

## Enumerations
enum | IP_UART_002_PARITY_T { UART_PARITY_NONE = (0x00 << 4), UART_PARITY_EVEN = (0x02 << 4), UART_PARITY_ODD = (0x03 << 4) }
| UART Parity type definitions. More...
enum | IP_UART_002_FITO_LEVEL_T { UART_FIFO_TRGLEV0 = 0, UART_FIFO_TRGLEV1, UART_FIFO_TRGLEV2, UART_FIFO_TRGLEV3 }
| FIFO Level type definitions. More...
enum | IP_UART_002_STOPLEN_T { UART_STOPLEN_1 = (0 << 6), UART_STOPLEN_2 = (1 << 6) }
| UART Stop bit type definitions. More...
enum | IP_UART_002_DATALEN_T { UART_DATALEN_7 = (0x00 << 2), UART_DATALEN_8 = (0x01 << 2), UART_DATALEN_9 = (0x02 << 2) }
| UART Databit length type definitions. More...
enum | IP_UART_002_CLKPOL_T { UART_CLKPOL_FALLING = (0 << 12), UART_CLKPOL_RISING = (1 << 12) }
| UART clock polarity and sampling edge of received data type definitions. More...

## Functions
STATIC INLINE void | IP_UART_Init (IP_USART_002_T *pUART)
| Initialise the UART.
STATIC INLINE void | IP_UART_SetBaudRate (IP_USART_002_T *pUART, uint32_t baudrate)
| Set USART Baud Rate Generator register.
STATIC INLINE uint32_t | IP_UART_GetBaudRate (IP_USART_002_T *pUART)
| Get the USART Baud Rate Generator register.
STATIC INLINE void | IP_UART_Transmit (IP_USART_002_T *pUART, uint8_t data)
| Write data to transmit register.
STATIC INLINE uint8_t | IP_UART_Receive (IP_USART_002_T *pUART)
| Get received UART data.
STATIC INLINE uint32_t | IP_UART_GetIntStatus (IP_USART_002_T *pUART)
| Get the interrupt status register.
STATIC INLINE uint32_t | IP_UART_GetStatus (IP_USART_002_T *pUART)
| Get the UART status register.
STATIC INLINE void | IP_UART_ClearStatus (IP_USART_002_T *pUART, uint32_t StatusFlag)
| Clear the UART status.
void | IP_UART_Config (IP_USART_002_T *pUART, IP_UART_002_DATALEN_T Databits, IP_UART_002_PARITY_T Parity, IP_UART_002_STOPLEN_T Stopbits)
| Configure the UART protocol.
void | IP_UART_IntEnable (IP_USART_002_T *pUART, uint32_t UARTIntCfg, FunctionalState NewState)
| Enable/Disable UART Interrupts.

## Macro Definition Documentation

#define CTS (0x01 << 4)

Status of CTS signal

Definition at line 124 of file usart_002.h.

#define CTS_DELTA (0x01 << 5)

Change in CTS state

Definition at line 125 of file usart_002.h.

#define CTS_DELTA_INT (0x01 << 5)

Change in CTS state interrupt

Definition at line 110 of file usart_002.h.

#define DELTA_RXBRK (0x01 << 11)

Change in receive break detection

Definition at line 129 of file usart_002.h.

#define DELTA_RXBRK_INT (0x01 << 11)

Change in receiver break detection interrupt

Definition at line 113 of file usart_002.h.

#define FRM_ERR (0x01 << 13)

Frame error

Definition at line 131 of file usart_002.h.

#define FRM_ERR_INT (0x01 << 13)

Frame error interrupt

Definition at line 115 of file usart_002.h.

#define OVRN_ERR (0x01 << 8)

Overrun error

Definition at line 127 of file usart_002.h.

#define OVRN_ERR_INT (0x01 << 8)

Overrun error interrupt

Definition at line 112 of file usart_002.h.

#define PAR_ERR (0x01 << 14)

Parity error

Definition at line 132 of file usart_002.h.

#define PAR_ERR_INT (0x01 << 14)

Parity error interrupt

Definition at line 116 of file usart_002.h.

#define RXBRK (0x01 << 10)

Received break

Definition at line 128 of file usart_002.h.

#define RXIDLE (0x01 << 1)

Receiver idle

Definition at line 121 of file usart_002.h.

#define RXNOISE (0x01 << 15)

Received noise

Definition at line 133 of file usart_002.h.

#define RXNOISE_INT (0x01 << 15)

Received noise interrupt

Definition at line 117 of file usart_002.h.

#define RXRDY (0x01 << 0)

Receiver ready

Definition at line 120 of file usart_002.h.

#define RXRDY_INT (0x01 << 0)

Receive Ready interrupt

Definition at line 108 of file usart_002.h.

#define START_DETECT (0x01 << 12)

Start detected

Definition at line 130 of file usart_002.h.

#define START_DETECT_INT (0x01 << 12)

Start detect interrupt

Definition at line 114 of file usart_002.h.

#define TXIDLE (0x01 << 3)

Transmitter idle

Definition at line 123 of file usart_002.h.

#define TXINT_DIS (0x01 << 6)

Transmitter disabled

Definition at line 126 of file usart_002.h.

#define TXINT_DIS_INT (0x01 << 6)

Transmitter disable interrupt

Definition at line 111 of file usart_002.h.

#define TXRDY (0x01 << 2)

Transmitter ready

Definition at line 122 of file usart_002.h.

#define TXRDY_INT (0x01 << 2)

Transmit Ready interrupt

Definition at line 109 of file usart_002.h.

#define UART_002_ENABLE (1UL)

Definition at line 136 of file usart_002.h.

#define UART_002_SYNCEN | ( |  | n | ) | ((n) == ENABLE ? (1 << 11) : 0)

Definition at line 135 of file usart_002.h.

## Enumeration Type Documentation

enum IP_UART_002_CLKPOL_T

UART clock polarity and sampling edge of received data type definitions.

Enumerator:

  UART_CLKPOL_FALLING | Falling edge. Un_RXD is sampled on the falling edge of SCLK
  UART_CLKPOL_RISING | Rising edge. Un_RXD is sampled on the rising edge of SCLK

Definition at line 102 of file usart_002.h.

enum IP_UART_002_DATALEN_T

UART Databit length type definitions.

Enumerator:

  UART_DATALEN_7 | UART 7 bit length mode
  UART_DATALEN_8 | UART 8 bit length mode
  UART_DATALEN_9 | UART 9 bit length mode

Definition at line 93 of file usart_002.h.

enum IP_UART_002_FITO_LEVEL_T

FIFO Level type definitions.

Enumerator:

  UART_FIFO_TRGLEV0 | UART FIFO trigger level 0: 1 character
  UART_FIFO_TRGLEV1 | UART FIFO trigger level 1: 4 character
  UART_FIFO_TRGLEV2 | UART FIFO trigger level 2: 8 character
  UART_FIFO_TRGLEV3 | UART FIFO trigger level 3: 14 character

Definition at line 75 of file usart_002.h.

enum IP_UART_002_PARITY_T

UART Parity type definitions.

Enumerator:

  UART_PARITY_NONE | No parity
  UART_PARITY_EVEN | Odd parity
  UART_PARITY_ODD | Even parity

Definition at line 66 of file usart_002.h.

enum IP_UART_002_STOPLEN_T

UART Stop bit type definitions.

Enumerator:

  UART_STOPLEN_1 | UART One Stop Bit Select
  UART_STOPLEN_2 | UART Two Stop Bits Select

Definition at line 85 of file usart_002.h.

## Function Documentation

STATIC INLINE void IP_UART_ClearStatus | ( | IP_USART_002_T * | pUART,
|  | uint32_t | StatusFlag
| ) |  |

Clear the UART status.

Parameters

  pUART | : Pointer to selected UARTx peripheral
  StatusFlag | : status flag to be cleared

Returns
  Nothing

Definition at line 216 of file usart_002.h.

void IP_UART_Config | ( | IP_USART_002_T * | pUART,
|  | IP_UART_002_DATALEN_T | Databits,
|  | IP_UART_002_PARITY_T | Parity,
|  | IP_UART_002_STOPLEN_T | Stopbits
| ) |  |

Configure the UART protocol.

Parameters

  pUART | : Pointer to selected UARTx peripheral
  Databits,: | Selects the data size for the USART
  Parity | : Selects what type of parity is used by the USART
  Stopbits,: | Selects number of stop bits appended to transmitted data

Returns
  Nothing

Definition at line 51 of file usart_002.c.

STATIC INLINE uint32_t IP_UART_GetBaudRate | ( | IP_USART_002_T * | pUART | ) |

Get the USART Baud Rate Generator register.

Parameters

  pUART | : Pointer to selected UARTx peripheral

Returns
  Baud Rate Generator register value

Definition at line 164 of file usart_002.h.

STATIC INLINE uint32_t IP_UART_GetIntStatus | ( | IP_USART_002_T * | pUART | ) |

Get the interrupt status register.

Parameters

  pUART | : Pointer to selected UARTx peripheral

Returns
  Interrupt status register

Definition at line 195 of file usart_002.h.

STATIC INLINE uint32_t IP_UART_GetStatus | ( | IP_USART_002_T * | pUART | ) |

Get the UART status register.

Parameters

  pUART | : Pointer to selected UARTx peripheral

Returns
  UART status register

Definition at line 205 of file usart_002.h.

STATIC INLINE void IP_UART_Init | ( | IP_USART_002_T * | pUART | ) |

Initialise the UART.

Parameters

  pUART | : Pointer to selected UARTx peripheral

Returns
  Nothing

Definition at line 143 of file usart_002.h.

void IP_UART_IntEnable | ( | IP_USART_002_T * | pUART,
|  | uint32_t | UARTIntCfg,
|  | FunctionalState | NewState
| ) |  |

Enable/Disable UART Interrupts.

Parameters

  pUART | : Pointer to selected UARTx peripheral
  UARTIntCfg | : Specifies the interrupt flag
  NewState | : New state, ENABLE or DISABLE

Returns
  Nothing

Definition at line 61 of file usart_002.c.

STATIC INLINE uint8_t IP_UART_Receive | ( | IP_USART_002_T * | pUART | ) |

Get received UART data.

Parameters

  pUART | : Pointer to selected UARTx peripheral

Returns
  Received data

Definition at line 185 of file usart_002.h.

STATIC INLINE void IP_UART_SetBaudRate | ( | IP_USART_002_T * | pUART,
|  | uint32_t | baudrate
| ) |  |

Set USART Baud Rate Generator register.

Parameters

  pUART | : Pointer to selected UARTx peripheral
  baudrate,: | Value for Baud Rate Generator register

Returns
  Nothing

Definition at line 154 of file usart_002.h.

STATIC INLINE void IP_UART_Transmit | ( | IP_USART_002_T * | pUART,
|  | uint8_t | data
| ) |  |

Write data to transmit register.

Parameters

  pUART | : Pointer to selected UARTx peripheral
  data | : Transmit Data

Returns
  Nothing

Definition at line 175 of file usart_002.h.