Project 1  4×4 Keypad
Neff Site
Macros | Functions
usart.h File Reference

This module enables communication via USART. More...

#include "board.h"

Go to the source code of this file.

Macros

#define USART_PORT   USB_USART_PORT
 
#define USART_MODULE   USB_USART_MODULE
 
#define USART_RX_PIN_bp   USB_USART_RX_PIN_bp
 
#define USART_RX_PIN_bm   USB_USART_RX_PIN_bm
 
#define USART_TX_PIN_bp   USB_USART_TX_PIN_bp
 
#define USART_TX_PIN_bm   USB_USART_TX_PIN_bm
 
#define USART_DRE_vect   USB_USART_DRE_vect
 
#define USART_RXC_vect   USB_USART_RXC_vect
 
#define USART_BSEL_gc   11
 
#define USART_BSCALE_gc   -7
 
#define USART_CONFIG   (USART_CHSIZE_8BIT_gc | USART_PMODE_DISABLED_gc)
 

Functions

void usart_init (void)
 Initialize the USART. More...
 
uint8_t usart_receive_complete (void)
 Receive complete. More...
 
uint8_t usart_receive (void)
 Receive data. More...
 
uint8_t usart_data_register_empty (void)
 Data register empty. More...
 
void usart_transmit (uint8_t data)
 Transmit data. More...
 

Detailed Description

This module enables communication via USART.

Author
Wolfgang Neff
Version
2.0
Date
2018-07-04
History
Created: 2012-09-03
Modified: 2014-10-17
Modified: 2015-01-28
Modified: 2018-07-04

Macro Definition Documentation

◆ USART_BSCALE_gc

#define USART_BSCALE_gc   -7

◆ USART_BSEL_gc

#define USART_BSEL_gc   11

◆ USART_CONFIG

#define USART_CONFIG   (USART_CHSIZE_8BIT_gc | USART_PMODE_DISABLED_gc)

◆ USART_DRE_vect

#define USART_DRE_vect   USB_USART_DRE_vect

◆ USART_MODULE

#define USART_MODULE   USB_USART_MODULE

◆ USART_PORT

#define USART_PORT   USB_USART_PORT

◆ USART_RX_PIN_bm

#define USART_RX_PIN_bm   USB_USART_RX_PIN_bm

◆ USART_RX_PIN_bp

#define USART_RX_PIN_bp   USB_USART_RX_PIN_bp

◆ USART_RXC_vect

#define USART_RXC_vect   USB_USART_RXC_vect

◆ USART_TX_PIN_bm

#define USART_TX_PIN_bm   USB_USART_TX_PIN_bm

◆ USART_TX_PIN_bp

#define USART_TX_PIN_bp   USB_USART_TX_PIN_bp

Function Documentation

◆ usart_data_register_empty()

uint8_t usart_data_register_empty ( void  )

Data register empty.

Checks if the data register is empty. If it is empty new data can be transmitted.

Returns
True if the data register is empty.

◆ usart_init()

void usart_init ( void  )

Initialize the USART.

Initializes the USART the gateway. The baud rate and the serial line parameters can be specified by the predefined constants.

◆ usart_receive()

uint8_t usart_receive ( void  )

Receive data.

Waits until a byte of data has been received and returns it.

Returns
The data received.

◆ usart_receive_complete()

uint8_t usart_receive_complete ( void  )

Receive complete.

Checks if a new data byte has been received.

Returns
True if a data byte has been received.

◆ usart_transmit()

void usart_transmit ( uint8_t  data)

Transmit data.

Waits until the transmit buffer is empty and then transmits the passed byte of data.

Parameters
dataThe data to be transmitted.
Contact