uart_lib.h File Reference

#include "uart_drv.h"
#include "lib_mcu/uart/uart_bdr.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

char 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.


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.

Referenced by uart_init().


Function Documentation

char uart_getchar ( void   ) 

This function allows to get a character from the UART.

Returns:
character read.

Definition at line 62 of file uart_lib.c.

References Uart_ack_rx_byte, Uart_get_byte, and Uart_rx_ready.

Referenced by build_cmd().

00063 {
00064   register char c;
00065 
00066   while(!Uart_rx_ready());
00067   c = Uart_get_byte();
00068   Uart_ack_rx_byte();
00069   return c;
00070 }

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

References BAUDRATE, TRUE, UART_CONFIG, Uart_double_bdr, Uart_enable, Uart_hw_init, and Uart_set_baudrate.

Referenced by ushell_task_init().

00035 {
00036 #ifndef UART_U2
00037   Uart_set_baudrate(BAUDRATE);
00038   Uart_hw_init(UART_CONFIG);
00039 #else
00040   Uart_set_baudrate(BAUDRATE/2);
00041   Uart_double_bdr();
00042   Uart_hw_init(UART_CONFIG);
00043 
00044 #endif
00045   Uart_enable();
00046   return TRUE;
00047 }

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

References Uart_send_byte, Uart_set_tx_busy, and Uart_tx_ready.

00051 {
00052   while(!Uart_tx_ready());
00053   Uart_set_tx_busy(); // Set Busy flag before sending (always)
00054   Uart_send_byte(ch);
00055     
00056   return ch;
00057 }

bit uart_test_hit ( void   ) 

This function allows to inform if a character was received.

Returns:
True if character received.

Definition at line 28 of file uart_lib.c.

References Uart_rx_ready.

Referenced by build_cmd().

00029 {
00030 return Uart_rx_ready();
00031 }

Here is the caller graph for this function:


Generated on Wed Jul 12 16:55:24 2006 for Atmel BLDC Sensorless on ATAVRMC100 by  doxygen 1.4.7