megaAVR STK600 AVR libc setbaud Example
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | _ASSERT_ENABLE_ |
#define | TIMEOUT 250 |
Functions | |
int | main (void) |
Example application on how to use the libc setbaud utility. More... | |
static uint8_t | uart_getchar (void) |
Function for getting a char from the UART. More... | |
static void | uart_init (void) |
Initialize the uart with correct baud rate settings. More... | |
static void | uart_putchar (uint8_t data) |
Function for sending a char over the UART. More... | |
#define _ASSERT_ENABLE_ |
#define TIMEOUT 250 |
Referenced by uart_getchar().
int main | ( | void | ) |
Example application on how to use the libc setbaud utility.
This application shows how to use the avr libc setbaud utility to get the correct values for the baud rate registers. It also performs a test where it sends a character on the UART and check if the same char is received back.
References Assert, uart_getchar(), uart_init(), and uart_putchar().
|
static |
|
static |
Initialize the uart with correct baud rate settings.
This function will initialize the UART baud rate registers with the correct values using the AVR libc setbaud utility. In addition set the UART to 8-bit, 1 stop and no parity.
References UART_PORT_DDR, UART_RX_PIN, and UART_TX_PIN.
Referenced by main().
|
static |
Function for sending a char over the UART.
data | the data to send over UART |
Referenced by main().