|
SAM4SD32 (SAM4S-EK2)
|
Uart Serial for SAM. More...
#include "compiler.h"#include "sysclk.h"#include "uart.h"#include "usart.h"#include "conf_uart_serial.h"Go to the source code of this file.
Data Structures | |
| struct | uart_rs232_options |
| Input parameters when initializing RS232 and similar modes. More... | |
Typedefs | |
| typedef Usart * | usart_if |
| This type can be used independently to refer to USART module for the architecture used. | |
| typedef struct uart_rs232_options | usart_rs232_options_t |
| Input parameters when initializing RS232 and similar modes. | |
| typedef usart_rs232_options_t | usart_serial_options_t |
Functions | |
| static void | usart_serial_getchar (usart_if p_usart, uint8_t *data) |
| Waits until a character is received, and returns it. | |
| static void | usart_serial_init (usart_if p_usart, usart_serial_options_t *opt) |
| Initializes the Usart in master mode. | |
| static uint32_t | usart_serial_is_rx_ready (usart_if p_usart) |
| Check if Received data is ready. | |
| static int | usart_serial_putchar (usart_if p_usart, const uint8_t c) |
| Sends a character with the USART. | |
| status_code_t | usart_serial_read_packet (usart_if usart, uint8_t *data, size_t len) |
| Receive a sequence of bytes to a USART device. | |
| status_code_t | usart_serial_write_packet (usart_if usart, const uint8_t *data, size_t len) |
| Send a sequence of bytes to a USART device. | |
Uart Serial for SAM.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
\cond ASF_LICENSE
Definition in file uart_serial.h.
This type can be used independently to refer to USART module for the architecture used.
It refers to the correct type definition for the architecture, ie. USART_t* for XMEGA or avr32_usart_t* for UC3.
Definition at line 78 of file uart_serial.h.
| typedef struct uart_rs232_options usart_rs232_options_t |
Input parameters when initializing RS232 and similar modes.
Definition at line 76 of file uart_serial.h.
|
inlinestatic |
Waits until a character is received, and returns it.
| p_usart | Base address of the USART instance. |
| data | Data to read |
Definition at line 476 of file uart_serial.h.
References UART0, UART1, USART0, USART1, and usart_read().
Referenced by stdio_serial_init(), and usart_serial_read_packet().
|
inlinestatic |
Initializes the Usart in master mode.
| p_usart | Base address of the USART instance. |
| opt | Options needed to set up RS232 communication (see usart_serial_options_t). |
Definition at line 87 of file uart_serial.h.
References sam_usart_opt_t::baudrate, uart_rs232_options::baudrate, sam_usart_opt_t::channel_mode, sam_usart_opt_t::char_length, uart_rs232_options::charlength, ID_UART0, ID_UART1, ID_USART0, ID_USART1, sam_usart_opt_t::parity_type, uart_rs232_options::paritytype, sam_usart_opt_t::stop_bits, uart_rs232_options::stopbits, UART0, UART1, US_MR_CHMODE_NORMAL, USART0, USART1, usart_enable_rx(), usart_enable_tx(), and usart_init_rs232().
Referenced by stdio_serial_init().
|
inlinestatic |
Check if Received data is ready.
| p_usart | Base address of the USART instance. |
| 1 | One data has been received. |
| 0 | No data has been received. |
Definition at line 577 of file uart_serial.h.
References UART0, UART1, USART0, USART1, and usart_is_rx_ready().
|
inlinestatic |
Sends a character with the USART.
| p_usart | Base address of the USART instance. |
| c | Character to write. |
| 1 | The character was written. |
| 0 | The function timed out before the USART transmitter became ready to send. |
Definition at line 376 of file uart_serial.h.
References UART0, UART1, USART0, USART1, and usart_write().
Referenced by stdio_serial_init(), and usart_serial_write_packet().
| status_code_t usart_serial_read_packet | ( | usart_if | usart, |
| uint8_t * | data, | ||
| size_t | len ) |
Receive a sequence of bytes to a USART device.
| usart | Base address of the USART instance. |
| data | data buffer to write |
| len | Length of data |
Definition at line 62 of file usart_serial.c.
References usart_serial_getchar().
| status_code_t usart_serial_write_packet | ( | usart_if | usart, |
| const uint8_t * | data, | ||
| size_t | len ) |
Send a sequence of bytes to a USART device.
| usart | Base address of the USART instance. |
| data | data buffer to write |
| len | Length of data |
Definition at line 45 of file usart_serial.c.
References usart_serial_putchar().