uart.h

Go to the documentation of this file.
00001 /****************************************************************************/
00018 #ifndef _UART_H
00019 #define _UART_H
00020 
00021 /******************************************************************************
00022                    Includes section
00023 ******************************************************************************/
00024 // \cond
00025 #include <halUart.h>
00026 
00027 /******************************************************************************
00028                    Define(s) section
00029 ******************************************************************************/
00030 #define UART_FLOW_CONTROL_NONE 0
00031 #define UART_FLOW_CONTROL_HARDWARE 1
00032 #define UART_DTR_CONTROL 2
00033 
00034 #ifndef NUM_USART_CHANNELS
00035   #define NUM_USART_CHANNELS 2 // Number USART channels
00036 #endif
00037 
00038 #if defined(ATMEGA1281) || defined(ATMEGA2561) || defined(ATMEGA1284) || defined(AT90USB1287)
00039   // this define is used only by HAL.
00040   #define USART_SPI_MODE 16
00041 #endif
00042 // \endcond
00043 
00044 /******************************************************************************
00045                    Types section
00046 ******************************************************************************/
00048 typedef struct
00049 {
00052   uint8_t tty;
00058   UartMode_t mode;
00073   UartBaudRate_t baudrate;
00079   UartData_t dataLength;
00084   UartParity_t parity;
00088   UartStopBits_t stopbits;
00092   UartSyncMode_t edge;
00094   UartClckMode_t syncMode;
00098   uint8_t *rxBuffer;
00100   uint16_t rxBufferLength;
00104   uint8_t *txBuffer;
00106   uint16_t txBufferLength;
00110   void (*rxCallback)(uint8_t);
00113   void (*txCallback)();
00119   uint8_t flowControl;
00120 } HAL_UartDescriptor_t;
00121 
00122 /******************************************************************************
00123                    Prototypes section
00124 ******************************************************************************/
00125 /**************************************************************************/
00137 int HAL_OpenUart(HAL_UartDescriptor_t *descriptor);
00138 
00139 /*************************************************************************/
00149 int HAL_CloseUart(HAL_UartDescriptor_t *descriptor);
00150 
00151 /**************************************************************************/
00170 int HAL_WriteUart(HAL_UartDescriptor_t *descriptor, uint8_t *buffer, uint8_t length);
00171 
00172 /*************************************************************************/
00188 int HAL_ReadUart(HAL_UartDescriptor_t *descriptor, uint8_t *buffer, uint8_t length);
00189 
00190 /**************************************************************************/
00201 int HAL_OnUartCts(HAL_UartDescriptor_t *descriptor);
00202 
00203 /**************************************************************************/
00214 int HAL_OffUartCts(HAL_UartDescriptor_t *descriptor);
00215 
00216 /**************************************************************************/
00228 int HAL_ReadUartRts(HAL_UartDescriptor_t *descriptor);
00229 
00230 /**************************************************************************/
00242 int HAL_ReadUartDtr(HAL_UartDescriptor_t *descriptor);
00243 
00244 /**************************************************************************/
00255 int HAL_IsTxEmpty(HAL_UartDescriptor_t *descriptor);
00256 
00257 #if defined(ATMEGA1281) || defined(ATMEGA2561) || defined(ATMEGA1284) || defined(AT90USB1287)
00258 /**************************************************************************/
00264 void HAL_EnableDtrWakeUp(void (* callback)(void));
00265 
00266 /**************************************************************************/
00269 void HAL_DisableDtrWakeUp(void);
00270 #endif
00271 
00272 #endif /* _UART_H */
00273 // eof uart.h

Generated on Mon Feb 16 17:53:40 2009 for BitCloud Stack Documentation by  doxygen 1.5.1-p1