Contiki 2.5
uart.h
Go to the documentation of this file.
1 /** @file hal/micro/cortexm3/uart.h
2  * @brief Header for STM32W uart drivers, supporting IAR's standard library
3  * IO routines.
4  *
5  * <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
6  */
7 
8 #ifndef __UART_MIN_H__
9 #define __UART_MIN_H__
10 #ifdef __ICCARM__
11 #include <yfuns.h>
12 #endif
13 
14 /**
15  * @brief A list of the possible values for the parity parameter to uartInit()
16  */
17 typedef enum
18 {
19  PARITY_NONE = 0,
20  PARITY_ODD = 1,
21  PARITY_EVEN = 2
22 } SerialParity;
23 
24 /**
25  * @brief Initialize the UART
26  *
27  * @param baudrate The baudrate which will be used for communication.
28  * Ex: 115200
29  *
30  * @param databits The number of data bits used for communication.
31  * Valid values are 7 or 8
32  *
33  * @param parity The type of parity used for communication.
34  * See the SerialParity enum for possible values
35  *
36  * @return stopbits The number of stop bits used for communication.
37  * Valid values are 1 or 2
38  */
39 void uartInit(int32u baudrate, int8u databits, SerialParity parity, int8u stopbits);
40 
41 #ifdef __ICCARM__
42 /**
43  * @brief Flush the output stream. DLib_Config_Full.h defines fflush(), but
44  * this library includes too much code so we compile with DLib_Config_Normal.h
45  * instead which does not define fflush(). Therefore, we manually define
46  * fflush() in the low level UART driver. This function simply redirects
47  * to the __write() function with a NULL buffer, triggering a flush.
48  *
49  * @param handle The output stream. Should be set to 'stdout' like normal.
50  *
51  * @return Zero, indicating success.
52  */
53 size_t fflush(int handle);
54 
55 /**
56  * @brief Define the stdout stream. Since we compile with DLib_Config_Normal.h
57  * it does not define 'stdout'. There is a low-level IO define '_LLIO_STDOUT'
58  * which is equivalent to stdout. Therefore, we define 'stdout' to be
59  * '_LLIO_STDOUT'.
60  */
61 #define stdout _LLIO_STDOUT
62 #endif
63 /**
64  * @brief Read the input byte if any.
65  */
66 boolean __io_getcharNonBlocking(int8u *data);
67 void __io_putchar( char c );
68 int __io_getchar(void);
69 void __io_flush( void );
70 
71 
72 #endif //__UART_MIN_H__