halUARTCfg_t

typedef struct
{
  bool   configured;

uint16 baudRate;
  bool   flowControl;  
  uint16 flowControlThreshold; 
  uint8  idleTimeout;
  uint16 rx;
  uint16 tx;  
  bool   intEnable;      
  uint32 rxChRvdTime;
  halUARTCBack_t callBackFunc;
}halUARTCfg_t;
.configured – Set by the function when the port is setup correctly and read to be used.


当串口准备好时由函数设置。
.baudRate – The baud rate of the port to be opened. (Check UART Ports Table)


串口的速率
.flowControl – UART flow control can be set as TRUE or FALSE. TRUE value will
enable flow control and FALSE value will disable flow control.


流控制,TRUE 允许对串口进行流控制;FALSE不允许对串口进行流控制
.flowControlThreshold – Number of bytes left before Rx buffer reaches maxRxBufSize.
When Rx buffer reaches this number (maxRxBufSize – flowControlThreshold) and flowControl is
TRUE, a callback will be sent back to the application with HAL_UART_RX_ABOUT_FULL
event. 


在RX缓存达到maxRxBufSize之前还有多少字节空余。当到达maxRxBufSize – flowControlThreshold时并且流控制打开时,会触发相应的应用事件:HAL_UART_RX_ABOUT_FULL
.idleTimeout – Rx timeout period in milliseconds. If Rx buffer haven’t got new data for idleTimout amount of time, a callback will be issued to the application with
HAL_UART_RX_TIMEOUT event. The application can choose to read everything from the Rx
buffer or just partial of it.


如果在idleTimout 时间内RX还没有得到新的数据,将会触发相应的事件HAL_UART_RX_TIMEOUT ,这时应用可以选择读出所有RX的值或者一部分。
.rx – Contains halUARTBufControl_t structure that used to manipulate Rx buffer


包含 halUARTBufControl_t 数据结构用于控制RX缓存
.tx – Contains halUARTBufControl_t structure that used to manipulate Tx buffer
包含halUARTBufControl_t 数据结构用于控制TX缓存
typedef struct
{
  uint16 bufferHead;
  uint16 bufferTail;
  uint16 maxBufSize;
  uint8 *pBuffer;
}halUARTBufControl_t; 
 bufferHead – contain the index of the starting position of the Rx/Tx buffer


                 Rx/Tx 缓冲区中的起始字节位置的索引
 bufferTail – contains the index of the ending position of the Rx/Tx buffer


                 Rx/Tx 缓冲区中的末尾字节位置的索引   
maxBufSize – holds maximum size of the Rx/Tx buffer that the UART can hold at a
time. When this number is reached, HAL_UART_RX_FULL or HAL_UART_TX_FULL
will be sent back to the application as an event through the callback system.


 Rx/Tx 缓冲区一次最多接收或发送的字节数,当接收或者发送字节数到达该值时,产生HAL_UART_RX_FULL or HAL_UART_TX_FULL事件。
*pBuffer – pointer to the buffer that contains the Rx data


指向接收字节的缓冲区


.intEnable – enable/disable interrupt. It can be set as TRUE or FALSE. TRUE value will
enable the interrupt and FALSE value will disable the interrupt.


串口中断使能
callBackFunc –  This callback is called when there is an event such as Tx done, Rx ready…


回调函数,应用层可以根据RX、TX出发的不同事件进行处理

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值