AVRTools
A Library for the AVR ATmega328 and ATmega2560 Microcontrollers
|
This file provides functions that provide a minimalist interface to USART3 available on the Arduino Mega (ATmega2560). More...
Go to the source code of this file.
Functions | |
void | initUSART3 (unsigned long baudRate) |
Initialize USART3 for serial receive and transmit. More... | |
void | transmitUSART3 (unsigned char data) |
Transmit a single byte on USART3. More... | |
void | transmitUSART3 (const char *data) |
Transmit a null-terminated string on USART3. More... | |
unsigned char | receiveUSART3 () |
Receive a byte on USART3. More... | |
void | releaseUSART3 () |
Release USART3, making pins 0 and 1 again available for non-USART use. More... | |
This file provides functions that provide a minimalist interface to USART3 available on the Arduino Mega (ATmega2560).
These functions are minimalist in the following sense:
To use these functions, include USART3Minimal.h in your source code and link against USART3Minimal.cpp.
For a more advanced USART3 interface, consider using either the USART3 or Serial3 interfaces. Both of these are available by including USART3.h instead of USART3Minimal.h.
void initUSART3 | ( | unsigned long | baudRate | ) |
Initialize USART3 for serial receive and transmit.
USART3 is tied to pins 14 (TX) and 15 (RX) on Arduino Mega (ATmega2560 pins PJ1, PJ0).
Communications are configured for 8 data bits, no parity, and 1 stop bit.
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).unsigned char receiveUSART3 | ( | ) |
Receive a byte on USART3.
You must first initialize USART3 by calling initUSART3().
This function blocks until the USART receives a byte.
void releaseUSART3 | ( | ) |
Release USART3, making pins 0 and 1 again available for non-USART use.
After calling this function, you cannot read or write to the USART unless you first call initUSART3().
void transmitUSART3 | ( | unsigned char | data | ) |
Transmit a single byte on USART3.
You must first initialize USART3 by calling initUSART3().
This function blocks until the USART becomes available and the byte can be transmitted.
data
the byte to be transmitted.void transmitUSART3 | ( | const char * | data | ) |
Transmit a null-terminated string on USART3.
You must first initialize USART3 by calling initUSART3().
This function blocks until the USART becomes available and all the bytes can be transmitted.
data
the null-terminated string to be transmitted.