#include "chip.h"
#include <assert.h>
#include <string.h>
Go to the source code of this file.
Functions |
void | UART_Configure (Uart *uart, uint32_t mode, uint32_t baudrate, uint32_t masterClock) |
| Configures an UART peripheral with the specified parameters.
|
void | UART_SetTransmitterEnabled (Uart *uart, uint8_t enabled) |
| Enables or disables the transmitter of an UART peripheral.
|
void | UART_SetReceiverEnabled (Uart *uart, uint8_t enabled) |
| Enables or disables the receiver of an UART peripheral.
|
uint32_t | UART_IsRxReady (Uart *uart) |
| Return 1 if a character can be read in UART.
|
uint8_t | UART_GetChar (Uart *uart) |
| Reads and returns a character from the UART.
|
uint32_t | UART_IsTxReady (Uart *uart) |
| Return 1 if a character can be send to UART.
|
void | UART_PutChar (Uart *uart, uint8_t c) |
| Sends one packet of data through the specified UART peripheral. This function operates synchronously, so it only returns when the data has been actually sent.
|
uint32_t | UART_GetStatus (Uart *uart) |
| Get present status.
|
void | UART_EnableIt (Uart *uart, uint32_t mode) |
| Enable interrupt.
|
void | UART_DisableIt (Uart *uart, uint32_t mode) |
| Disable interrupt.
|
uint32_t | UART_GetItMask (Uart *uart) |
| Return interrupt mask.
|
void | UART_SendBuffer (Uart *uart, uint8_t *pBuffer, uint32_t BuffLen) |
void | UART_ReceiveBuffer (Uart *uart, uint8_t *pBuffer, uint32_t BuffLen) |
void | UART_CompareConfig (Uart *uart, uint8_t Val1, uint8_t Val2) |
Detailed Description
Implementation of UART (Universal Asynchronous Receiver Transmitter) controller.
Definition in file uart.c.
Function Documentation
void UART_Configure |
( |
Uart * |
uart, |
|
|
uint32_t |
mode, |
|
|
uint32_t |
baudrate, |
|
|
uint32_t |
masterClock | |
|
) |
| | |
Configures an UART peripheral with the specified parameters.
- Parameters:
-
| uart | Pointer to the UART peripheral to configure. |
| mode | Desired value for the UART mode register (see the datasheet). |
| baudrate | Baudrate at which the UART should operate (in Hz). |
| masterClock | Frequency of the system master clock (in Hz). |
Definition at line 58 of file uart.c.
void UART_DisableIt |
( |
Uart * |
uart, |
|
|
uint32_t |
mode | |
|
) |
| | |
Disable interrupt.
- Parameters:
-
| uart | Pointer to an UART peripheral. |
| mode | Interrupt mode. |
Definition at line 195 of file uart.c.
void UART_EnableIt |
( |
Uart * |
uart, |
|
|
uint32_t |
mode | |
|
) |
| | |
Enable interrupt.
- Parameters:
-
| uart | Pointer to an UART peripheral. |
| mode | Interrupt mode. |
Definition at line 185 of file uart.c.
uint8_t UART_GetChar |
( |
Uart * |
uart |
) |
|
Reads and returns a character from the UART.
- Note:
- This function is synchronous (i.e. uses polling).
- Parameters:
-
| uart | Pointer to an UART peripheral. |
- Returns:
- Character received.
Definition at line 127 of file uart.c.
uint32_t UART_GetItMask |
( |
Uart * |
uart |
) |
|
Return interrupt mask.
- Parameters:
-
| uart | Pointer to an UART peripheral. |
Definition at line 204 of file uart.c.
uint32_t UART_GetStatus |
( |
Uart * |
uart |
) |
|
Get present status.
- Parameters:
-
| uart | Pointer to an UART peripheral. |
Definition at line 175 of file uart.c.
uint32_t UART_IsRxReady |
( |
Uart * |
uart |
) |
|
Return 1 if a character can be read in UART.
- Parameters:
-
| uart | Pointer to an UART peripheral. |
Definition at line 115 of file uart.c.
uint32_t UART_IsTxReady |
( |
Uart * |
uart |
) |
|
Return 1 if a character can be send to UART.
- Parameters:
-
| uart | Pointer to an UART peripheral. |
Definition at line 137 of file uart.c.
void UART_PutChar |
( |
Uart * |
uart, |
|
|
uint8_t |
c | |
|
) |
| | |
Sends one packet of data through the specified UART peripheral. This function operates synchronously, so it only returns when the data has been actually sent.
- Parameters:
-
| uart | Pointer to an UART peripheral. |
| c | Character to send |
Definition at line 159 of file uart.c.
void UART_SetReceiverEnabled |
( |
Uart * |
uart, |
|
|
uint8_t |
enabled | |
|
) |
| | |
Enables or disables the receiver of an UART peripheral.
- Parameters:
-
| uart | Pointer to an UART peripheral |
| enabled | If true, the receiver is enabled; otherwise it is disabled. |
Definition at line 102 of file uart.c.
void UART_SetTransmitterEnabled |
( |
Uart * |
uart, |
|
|
uint8_t |
enabled | |
|
) |
| | |
Enables or disables the transmitter of an UART peripheral.
- Parameters:
-
| uart | Pointer to an UART peripheral |
| enabled | If true, the transmitter is enabled; otherwise it is disabled. |
Definition at line 86 of file uart.c.