uart_lib.h File Reference

,v More...

#include "uart_drv.h"
#include "uart/uart_bdr.h"
#include "compiler.h"

Include dependency graph for uart_lib.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define AUTOBAUD   0
#define BAUDRATE   999
#define UART_CONFIG   MSK_UART_8BIT

Functions

r_uart_gtchar uart_getchar (void)
 This function allows to get a character from the UART.
bit uart_init (void)
 This function configures the UART configuration and timming following the constant definition of BAUDRATE and enables the UART controller.
r_uart_ptchar uart_putchar (p_uart_ptchar uc_wr_byte)
 This function allows to send a character on the UART.
bit uart_test_hit (void)
 This function allows to inform if a character was received.


Detailed Description

,v

Copyright (c) 2004 Atmel.

Please read file license.txt for copyright notice.

This file contains Uart lib header file.

Version:
1.14.4.4 demo-bldc-sensor-at90pwm3-4_6_0
Todo:
Bug:

Definition in file uart_lib.h.


Define Documentation

#define AUTOBAUD   0

Definition at line 33 of file uart_lib.h.

#define BAUDRATE   999

Definition at line 30 of file uart_lib.h.

#define UART_CONFIG   MSK_UART_8BIT

Definition at line 25 of file uart_lib.h.


Function Documentation

r_uart_gtchar uart_getchar ( void   ) 

This function allows to get a character from the UART.

Returns:
character read.

Definition at line 73 of file uart_lib.c.

References Lin_get_data, and Lin_rx_response_ready.

Referenced by build_cmd().

00074 {
00075     while(!Lin_rx_response_ready());
00076     return Lin_get_data();
00077 }

bit uart_init ( void   ) 

This function configures the UART configuration and timming following the constant definition of BAUDRATE and enables the UART controller.

Precondition:
before calling this function some declaration must be define in config.h:
  • FOSC Frequency of crystal in kHz (mandatory)Standard crystals available
  • BAUDRATE Baudrate in bit per second used for UART configuration (mandatory)
  • UART_CONFIG : (by default 8 bits| 1 bit stop |without parity)

Definition at line 54 of file uart_lib.c.

References BAUDRATE, BITSAMPLING, Byte_transfer_enable, Lin_set_btr_brr, Lin_set_data, and TRUE.

Referenced by ushell_task_init().

00055 {
00056    Lin_set_btr_brr(BITSAMPLING,BAUDRATE);
00057    Byte_transfer_enable();
00058    Lin_set_data(0xFF);
00059    return TRUE;
00060 }

r_uart_ptchar uart_putchar ( p_uart_ptchar  uc_wr_byte  ) 

This function allows to send a character on the UART.

Parameters:
uc_wr_byte character to print on UART.
Returns:
character sent.
Note:
the type p_uart_ptchar and r_uart_ptchar can be define to macth with a printf need.

Definition at line 63 of file uart_lib.c.

References Lin_set_data, and Lin_tx_response_ready.

Referenced by build_cmd(), print_hex16(), print_msg(), and ushell_task().

00064 {
00065    while (!Lin_tx_response_ready());
00066    Lin_set_data(ch);
00067    return (ch);
00068 }

bit uart_test_hit ( void   ) 

This function allows to inform if a character was received.

Returns:
True if character received.

Definition at line 48 of file uart_lib.c.

References Lin_rx_response_ready.

Referenced by build_cmd().

00049 {
00050   return (Lin_rx_response_ready());
00051 }


Generated on Wed Oct 22 15:04:00 2008 for AVR172 : Atmel BLDC control on ATAVRMC310 with ATmega32M1 by  doxygen 1.5.7.1