siwicom/C/usart.h

83 lines
3.3 KiB
C

#ifndef USART_H
#define USART_H
/*================================================================================================
usart.h SiWiCom copyright 2006 v1.0 (2006-05-22)
Name: Christoffer Martinsson E-mail: cm@cmtec.se
Name: Joakim Nilsson E-mail: mail@jopin.se
Description: Routines for USART
USART configuration is done by hardware.h witch must contain the following definitions:
(X=letter i.e PORTX=PORTB, n=number i.e PXn=PB4)
USART_DDR DDRX (Example: #define USART_DDR DDRD)
USART_PORT PORTX (Example: #define USART_PORT PORTD)
USART_RX PXn (Example: #define USART_RX PD0)
USART_TX PXn (Example: #define USART_TX PD1)
================================================================================================*/
/*================================================================================================
Functions
================================================================================================*/
/*================================================================================================
usartSetBaud
Description: Set baudrate. Input value should be acording to following formula:
baud = ((F_CPU/(8*BAUDRATE))-1)
Input: baud (uint8_t ((F_CPU/(8*BAUDRATE))-1))
Return: -
------------------------------------------------------------------------------------------------*/
void usartSetBaud(uint16_t baud);
/*================================================================================================
usartReceive
Description: Get byte from input buffer.
Input: -
Return: UDR (uint8_t)
------------------------------------------------------------------------------------------------*/
uint8_t usartReceive( void );
/*================================================================================================
usartSend
Description: Send byte to USART.
Input: data (uint8_t data byte to be send)
Return: -
------------------------------------------------------------------------------------------------*/
void usartSend(uint8_t data);
/*================================================================================================
usartSendString
Description: Write a string of characters to the USART.
Input: *stringPointer (uint8_t array)
Return: -
------------------------------------------------------------------------------------------------*/
void usartSendString (uint8_t *stringPointer);
/*================================================================================================
usartEnable
Description: Enable USART function.
Input: -
Return: -
------------------------------------------------------------------------------------------------*/
void usartEnable(void);
/*================================================================================================
usartDisable
Description: Disable USART function.
Input: -
Return: -
------------------------------------------------------------------------------------------------*/
void usartDisable(void);
/*================================================================================================
End
================================================================================================*/
#endif // USART_H