e_uart_char.h File Reference

Manage UART. More...


Functions

void e_init_uart1 (void)
 Init uart 1 at 115200bps, 8 data bits, 1 stop bit, Enable ISR for RX and TX.
int e_ischar_uart1 ()
 Check if something is comming on uart 1.
int e_getchar_uart1 (char *car)
 If available, read 1 char and put it in pointer.
void e_send_uart1_char (const char *buff, int length)
 Send a buffer of char of size length.
int e_uart1_sending (void)
 To check if the sending operation is done.
void e_init_uart2 (void)
 Init uart 2 at 115200bps, 8 data bits, 1 stop bit, Enable ISR for RX and TX.
int e_ischar_uart2 ()
 Check if something is comming on uart 2.
int e_getchar_uart2 (char *car)
 If available, read 1 char and put it in pointer.
void e_send_uart2_char (const char *buff, int length)
 Send a buffer of char of size length.
int e_uart2_sending (void)
 To check if the sending operation is done.

Variables

void * e_uart1_int_clr_addr
int e_uart1_int_clr_mask
void * e_uart2_int_clr_addr
int e_uart2_int_clr_mask


Detailed Description

Manage UART.

This module manage all the UART ressource.
The e-puck's microcontroller has two integreted UART: UART1 and UART2.

A little exemple to comunicate with the e-puck through the uart. For this exemple you have to connect your e-puck to your PC with bluetooth (if you don't know how it works, look at the end of page 3 of this doc: http://moodle.epfl.ch/mod/resource/view.php?id=12851). Then open the HyperTerminal with the correct port COM and launch the connection. "Give a character:" should appears on the HyperTerminal.

 #include <motor_led/e_init_port.h>
 #include <uart/e_uart_char.h>
 
 int main(void)
 {
        char car;
        e_init_port();
        e_init_uart1();
        e_send_uart1_char("\f\a", 2);           //new page on HyperTerminal
        while(1)
        {
                e_send_uart1_char("Give a character:\r\n", 19);
                // do nothing while the text is not sent and while nothing is comming from the user
                while(e_uart1_sending() || !e_ischar_uart1()) {} 
                e_getchar_uart1(&car);                  // read the character entered...
                e_send_uart1_char("You have wrote: ", 16);
                e_send_uart1_char(&car, 1);             //... and resend him to uart.
                e_send_uart1_char("\r\n\r\n",4);
        }
 }
Author:
Code: Michael Bonani
Doc: Jonathan Besuchet

Function Documentation

int e_getchar_uart1 ( char *  car  ) 

If available, read 1 char and put it in pointer.

Parameters:
car The pointer where the caracter will be stored if available
Returns:
1 if a char has been readed, 0 if no char is available

int e_getchar_uart2 ( char *  car  ) 

If available, read 1 char and put it in pointer.

Parameters:
car The pointer where the caracter will be stored if available
Returns:
1 if a char has been readed, 0 if no char is available

void e_init_uart1 ( void   ) 

Init uart 1 at 115200bps, 8 data bits, 1 stop bit, Enable ISR for RX and TX.

void e_init_uart2 ( void   ) 

Init uart 2 at 115200bps, 8 data bits, 1 stop bit, Enable ISR for RX and TX.

int e_ischar_uart1 (  ) 

Check if something is comming on uart 1.

Returns:
the number of characters available, 0 if none are available

int e_ischar_uart2 (  ) 

Check if something is comming on uart 2.

Returns:
the number of characters available, 0 if none are available

void e_send_uart1_char ( const char *  buff,
int  length 
)

Send a buffer of char of size length.

Parameters:
buff The top of the array where the data are stored
length The length of the array to send

void e_send_uart2_char ( const char *  buff,
int  length 
)

Send a buffer of char of size length.

Parameters:
buff The top of the array where the datas are stored
length The length of the array

int e_uart1_sending ( void   ) 

To check if the sending operation is done.

Returns:
1 if buffer sending is in progress, return 0 if not

int e_uart2_sending ( void   ) 

To check if the sending operation is done.

Returns:
1 if buffer sending is in progress, return 0 if not


Variable Documentation

void* e_uart1_int_clr_addr

int e_uart1_int_clr_mask

void* e_uart2_int_clr_addr

int e_uart2_int_clr_mask


Generated on Fri Feb 29 14:26:55 2008 for e-puck by  doxygen 1.5.4