Skip to content
Snippets Groups Projects
Commit 0a4a91c0 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Modified the usart4 module for the F4 family to use the UART data structures...

Modified the usart4 module for the F4 family to use the UART data structures insead of the USART ones.
parent d7d397f5
No related branches found
No related tags found
No related merge requests found
......@@ -111,7 +111,7 @@ void UART_DMA_TX_IRQHandler(void)
__HAL_DMA_DISABLE_IT(Uart4Handle.hdmatx, DMA_IT_TC);
/* Clear the transfer complete flag */
__HAL_DMA_CLEAR_FLAG(Uart4Handle.hdmatx, __HAL_DMA_GET_TC_FLAG_INDEX(Uart4Handle.hdmatx));
CLEAR_BIT(Uart4Handle.Instance->CR3, (UART_CR3_DMAT | UART_CR3_DMAR));
CLEAR_BIT(Uart4Handle.Instance->CR3, (USART_CR3_DMAT | USART_CR3_DMAR));
HAL_DMA_Abort(Uart4Handle.hdmatx);
// call the user function
comm_do_dma_send(usart4_comm_dev);
......@@ -149,7 +149,7 @@ void UART_DMA_RX_IRQHandler(void)
__HAL_DMA_DISABLE_IT(Uart4Handle.hdmarx, DMA_IT_TC);
/* Clear the transfer complete flag */
__HAL_DMA_CLEAR_FLAG(Uart4Handle.hdmarx, __HAL_DMA_GET_TC_FLAG_INDEX(Uart4Handle.hdmarx));
CLEAR_BIT(Uart4Handle.Instance->CR3, (UART_CR3_DMAT | UART_CR3_DMAR));
CLEAR_BIT(Uart4Handle.Instance->CR3, (USART_CR3_DMAT | USART_CR3_DMAR));
HAL_DMA_Abort(Uart4Handle.hdmarx);
// call the user function
comm_do_dma_receive(usart4_comm_dev);
......@@ -325,7 +325,7 @@ unsigned char usart4_send_dma(unsigned char *data,unsigned short int length)
__HAL_UART_CLEAR_FLAG(&Uart4Handle,UART_FLAG_TC);
/* Enable the DMA transfer for transmit request by setting the DMAT bit
in the UART CR3 register */
SET_BIT(Uart4Handle.Instance->CR3, UART_CR3_DMAT);
SET_BIT(Uart4Handle.Instance->CR3, USART_CR3_DMAT);
return 0x00;
}
......@@ -333,14 +333,14 @@ unsigned char usart4_send_dma(unsigned char *data,unsigned short int length)
unsigned char usart4_receive_dma(unsigned char *data,unsigned short int length)
{
HAL_DMA_Start_IT(Uart4Handle.hdmarx,(uint32_t)&Uart4Handle.Instance->DR,(uint32_t)data,length);
SET_BIT(Uart4Handle.Instance->CR3, UART_CR3_DMAR);
SET_BIT(Uart4Handle.Instance->CR3, USART_CR3_DMAR);
return 0x00;
}
unsigned char usart4_cancel_receive_dma(void)
{
CLEAR_BIT(Uart4Handle.Instance->CR3, (UART_CR3_DMAT | UART_CR3_DMAR));
CLEAR_BIT(Uart4Handle.Instance->CR3, (USART_CR3_DMAT | USART_CR3_DMAR));
HAL_DMA_Abort(Uart4Handle.hdmarx);
return 0x00;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment