⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart.h

📁 AVRGCC编写的很好用的串口通讯源程序
💻 H
字号:
#ifndef _UART_H_
#define _UART_H_

#define RX_BUFFER_SIZE 50
#define TX_BUFFER_SIZE 50

#define UART_DEFAULT_DATABITS	8
#define UART_DEFAULT_PARITY		0
#define UART__DEFAULT_STOPBITS	1
#define UART_DEFAULT_BAUD		9600L

/*! \brief UART _ioctl() command code to set the line speed.
 *
 * The configuration parameter specifies the input and output bit rate 
 * per second.
 */
#define UART_SETSPEED           0x0101

/*! \brief UART _ioctl() command code to query the line speed.
 *
 * The configuration parameter is set to the input and output bit rate 
 * per second.
 */
#define UART_GETSPEED           0x0102

/*! \brief UART _ioctl() command code to set the number of data bits.
 *
 * The configuration parameter specifies the number of data bits, 5, 6, 
 * 7, 8 or 9.
 */
#define UART_SETDATABITS        0x0103

/*! \brief UART _ioctl() command code to query the number of data bits.
 *
 * The configuration parameter is set to the number of data bits, 5, 6, 
 * 7, 8 or 9.
 */
#define UART_GETDATABITS        0x0104

/*! \brief UART _ioctl() command code to set the parity mode.
 *
 * The configuration parameter specifies the type of the parity bit, 
 * 0 (none), 1 (odd) or 2 (even).
 */
#define UART_SETPARITY          0x0105

/*! \brief UART _ioctl() command code to query the parity mode.
 *
 * The configuration parameter is set to the type of the parity bit, 
 * 0 (none), 1 (odd) or 2 (even).
 */
#define UART_GETPARITY          0x0106

/*! \brief UART _ioctl() command code to set the number of stop bits.
 *
 * The configuration parameter specifies the number of stop bits, 1 or 2.
 */
#define UART_SETSTOPBITS        0x0107

/*! \brief UART _ioctl() command code to query the number of stop bits.
 *
 * The configuration parameter is set to the number of stop bits, 1 or 2.
 */
#define UART_GETSTOPBITS        0x0108

void UartInit(void);
void UartIOCtl(uint16_t req, void *conf);
int UartGetc(void);
int UartPutc(char c);

#endif /* _UART_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -