usart.c File Reference
Serial interface functions.
More...
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
Go to the source code of this file.
Detailed Description
Serial interface functions.
- Author:
- Copyright (C) Peter Ivanov, 2010
Created 2010-08-07 11:48:53 Last modify: 2010-08-07 11:51:36 ivanovp {Time-stamp} Licence: GPL
Definition in file usart.c.
Define Documentation
| #define USART0_BAUD_RATE (19200ul) |
| #define USART_PRINTF_BUF_SIZE (128) |
| #define USART_UBBR_CALC |
( |
baud |
|
) |
(F_CPU / ((baud << 4)) - 1u) |
Function Documentation
| unsigned char USART0_getc |
( |
void |
|
) |
|
Read one byte from serial port.
It waits for the data.
- Returns:
- The received character.
Definition at line 43 of file usart.c.
| void USART0_init |
( |
void |
|
) |
|
| void USART0_printf |
( |
const char * |
fmt, |
|
|
|
... | |
|
) |
| | |
Printf function which uses UART interface to send.
Example:
UART_printf ("Number: %02i\r\n", number);
- Parameters:
-
| fmt | Printf format string. Example: "Value: %02i\r\n" |
Definition at line 89 of file usart.c.
| void USART0_putc |
( |
unsigned char |
data |
) |
|
Write one byte to the serial port.
- Parameters:
-
Definition at line 57 of file usart.c.
| void USART0_puts |
( |
const char * |
data |
) |
|
Write a null-terminated string to the serial port.
- Parameters:
-
Definition at line 71 of file usart.c.