AVRTools
A Library for the AVR ATmega328 and ATmega2560 Microcontrollers
|
This namespace bundles a high-level buffered interface to the USART3 hardware. It provides logical cohesion and prevents namespace collisions. More...
Functions | |
void | start (unsigned long baudRate, UsartSerialConfiguration config=kSerial_8N1) |
Initialize USART3 for buffered, asynchronous serial communications using interrupts. More... | |
void | stop () |
Stops buffered serial communications using interrupts on USART3. More... | |
size_t | write (char c) |
Write a single byte to the transmit buffer. More... | |
size_t | write (const char *c) |
Write a null-terminated string to the transmit buffer. More... | |
size_t | write (const char *c, size_t n) |
Write a character array of given size to the transmit buffer. More... | |
size_t | write (const uint8_t *c, size_t n) |
Write a byte array of given size to the transmit buffer. More... | |
void | flush () |
Flush transmit buffer. More... | |
int | peek () |
Examine the next character in the receive buffer without removing it from the buffer. More... | |
int | read () |
Return the next character in the receive buffer, removing it from the buffer. More... | |
bool | available () |
Determine if there is data in the receive buffer.. More... | |
This namespace bundles a high-level buffered interface to the USART3 hardware. It provides logical cohesion and prevents namespace collisions.
bool USART3::available | ( | ) |
Determine if there is data in the receive buffer..
void USART3::flush | ( | ) |
Flush transmit buffer.
This function blocks until the transmit buffer is empty and the last byte has been transmitted by USART3. flush() doesn't actually do anything to make the transmit happen; it simply waits for the transmission to complete.
int USART3::peek | ( | ) |
Examine the next character in the receive buffer without removing it from the buffer.
int USART3::read | ( | ) |
Return the next character in the receive buffer, removing it from the buffer.
void USART3::start | ( | unsigned long | baudRate, |
UsartSerialConfiguration | config = kSerial_8N1 |
||
) |
Initialize USART3 for buffered, asynchronous serial communications using interrupts.
You must call this function before using any of the other USART3 functions.
baudRate
the baud rate for the communications, usually one of the following values: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200 (although other values below can be specified).config
sets the configuration in term of data bits, parity, and stop bits. If omitted, the default is 8 data bits, no parity, and 1 stop bit. void USART3::stop | ( | ) |
Stops buffered serial communications using interrupts on USART3.
After calling this function, Arduino pins 0 and 1 are released and available for use as ordinary digital pins.
If you want to use USART3 again for buffered, asynchronous serial communications, you must again call start().
size_t USART3::write | ( | char | c | ) |
Write a single byte to the transmit buffer.
This function attempts to queue the data into the transmit buffer. If there is room in the transmit buffer, the function returns immediately. If not, the function blocks waiting for room to become available in the transmit buffer.
The data is transmitted asynchronously via USART3-related interrupts.
c
the char (byte) to write into the transmit buffersize_t USART3::write | ( | const char * | c | ) |
Write a null-terminated string to the transmit buffer.
This function attempts to queue the data into the transmit buffer. If there is room in the transmit buffer, the function returns immediately. If not, the function blocks waiting for room to become available in the transmit buffer.
The data is transmitted asynchronously via USART3-related interrupts.
c
the null-terminated string to write into the transmit buffer.size_t USART3::write | ( | const char * | c, |
size_t | n | ||
) |
Write a character array of given size to the transmit buffer.
This function attempts to queue the data into the transmit buffer. If there is room in the transmit buffer, the function returns immediately. If not, the function blocks waiting for room to become available in the transmit buffer.
The data is transmitted asynchronously via USART3-related interrupts
c
the character array to write into the transmit buffer.n
the number of elements from the array to write into the transmit buffer.size_t USART3::write | ( | const uint8_t * | c, |
size_t | n | ||
) |
Write a byte array of given size to the transmit buffer.
This function attempts to queue the data into the transmit buffer. If there is room in the transmit buffer, the function returns immediately. If not, the function blocks waiting for room to become available in the transmit buffer.
The data is transmitted asynchronously via USART3-related interrupts
c
the byte array to write into the transmit buffer.n
the number of elements from the array to write into the transmit buffer.