update seasky doc

This commit is contained in:
NeoZng
2022-11-11 22:23:17 +08:00
parent 33e10fa687
commit 55e12955b7
9 changed files with 118 additions and 42 deletions

View File

@@ -25,6 +25,8 @@ static void USARTServiceInit(usart_instance *_instance)
{
HAL_UARTEx_ReceiveToIdle_DMA(_instance->usart_handle, _instance->recv_buff, _instance->recv_buff_size);
// 关闭dma half transfer中断防止两次进入HAL_UARTEx_RxEventCallback()
// 这是HAL库的一个设计失误,发生DMA传输完成/半完成以及串口IDLE中断都会触发HAL_UARTEx_RxEventCallback()
// 我们只希望处理因此直接关闭DMA半传输中断第一种和第三种情况
__HAL_DMA_DISABLE_IT(_instance->usart_handle->hdmarx, DMA_IT_HT);
}
@@ -45,8 +47,14 @@ void USARTSend(usart_instance *_instance, uint8_t *send_buf, uint16_t send_size)
* @brief 每次dma/idle中断发生时都会调用此函数.对于每个uart实例会调用对应的回调进行进一步的处理
* 例如:视觉协议解析/遥控器解析/裁判系统解析
*
* @todo neozng给HAL库的github repo提了issue, ST在最新的一次更新中为此提供了一个HAL_UARTEx_GetRxEventType()函数
* 这样就可以通过调用这个函数来确认是什么中断导致了回调函数的调用
*
* @note because DMA half transfer iterrupt(DMA_IT_HT) would call this callback function too, so we just
* disable it when transfer complete using macro: __HAL_DMA_DISABLE_IT(huart->hdmarx,DMA_IT_HT)
* 关闭dma half transfer中断防止两次进入HAL_UARTEx_RxEventCallback()
* 这是HAL库的一个设计失误,发生DMA传输完成/半完成以及串口IDLE中断都会触发HAL_UARTEx_RxEventCallback()
* 我们只希望处理因此直接关闭DMA半传输中断第一种和第三种情况
*
* @param huart uart handle indicate which uart is being handled 发生中断的串口
* @param Size not used temporarily,此次接收到的总数居量,暂时没用