uart_lib.c File Reference

#include "uart_lib.h"

Include dependency graph for uart_lib.c:

Go to the source code of this file.

Functions

r_uart_gtchar uart_getchar (void)
bit uart_init (void)
r_uart_ptchar uart_putchar (p_uart_ptchar ch)
bit uart_test_hit (void)


Function Documentation

r_uart_gtchar uart_getchar ( void   ) 

This function allows to get a character from the UART

Returns:
character read.

Definition at line 71 of file uart_lib.c.

Referenced by build_cmd(), and ushell_task_init().

00072 {
00073   register char c;
00074 
00075   while(!Uart_rx_ready());
00076   c = Uart_get_byte();
00077   Uart_ack_rx_byte();
00078   return c;
00079 }

Here is the caller graph for this function:

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 43 of file uart_lib.c.

Referenced by ushell_task_init().

00044 {
00045 #ifndef UART_U2
00046   Uart_set_baudrate(BAUDRATE);
00047   Uart_hw_init(UART_CONFIG);
00048 #else
00049   Uart_set_baudrate(BAUDRATE/2);
00050   Uart_double_bdr();
00051   Uart_hw_init(UART_CONFIG);
00052 
00053 #endif
00054   Uart_enable();
00055   return TRUE;
00056 }

Here is the caller graph for this function:

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 59 of file uart_lib.c.

00060 {
00061   while(!Uart_tx_ready());
00062   Uart_set_tx_busy(); // Set Busy flag before sending (always)
00063   Uart_send_byte(ch);
00064     
00065   return ch;
00066 }

bit uart_test_hit ( void   ) 

This function allows to inform if a character was received

Returns:
True if character received.

Definition at line 37 of file uart_lib.c.

Referenced by build_cmd().

00038 {
00039 return Uart_rx_ready();
00040 }

Here is the caller graph for this function:


Generated on Tue Sep 16 18:11:26 2008 for Atmel BLDC Sinusoidal on ATAVRMC100 by  doxygen 1.5.3