added missing callbacks

This commit is contained in:
Robin Müller 2021-06-03 14:16:21 +02:00
parent 411d720a41
commit 0d9c3eef4f
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 156 additions and 121 deletions

View File

@ -49,8 +49,8 @@ void performHardwareInit() {
BSP_Config();
}
void MX_USART3_UART_Init(uint32_t baudRate)
{
void MX_USART3_UART_Init(uint32_t baudRate) {
__HAL_RCC_USART3_CONFIG(RCC_USART3CLKSOURCE_HSI);
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_USART3_CLK_ENABLE();

View File

@ -150,7 +150,6 @@ void ETH_IRQHandler(void)
HAL_ETH_IRQHandler(&EthHandle);
}
/**
* @}
*/

View File

@ -9,6 +9,7 @@
DMA_HandleTypeDef* hdma_tx = NULL;
DMA_HandleTypeDef* hdma_rx = NULL;
SPI_HandleTypeDef* spi_handle = NULL;
void setDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle) {
hdma_tx = txHandle;
@ -28,6 +29,11 @@ void setDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle) {
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{
GPIO_InitTypeDef GPIO_InitStruct;
if(hspi == NULL) {
printf("HAL_SPI_MspInit: Invalid SPI handle!\n");
return;
}
spi_handle = hspi;
if(hdma_tx == NULL || hdma_rx == NULL) {
printf("HAL_SPI_MspInit: Invalid DMA handles. Make sure to call setDmaHandles!\n");
@ -160,3 +166,33 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
HAL_NVIC_EnableIRQ(SPIx_IRQn);
}
}
/**
* @brief This function handles DMA Rx interrupt request.
* @param None
* @retval None
*/
void SPIx_DMA_RX_IRQHandler(void)
{
HAL_DMA_IRQHandler(spi_handle->hdmarx);
}
/**
* @brief This function handles DMA Tx interrupt request.
* @param None
* @retval None
*/
void SPIx_DMA_TX_IRQHandler(void)
{
HAL_DMA_IRQHandler(spi_handle->hdmatx);
}
/**
* @brief This function handles SPIx interrupt request.
* @param None
* @retval None
*/
void SPIx_IRQHandler(void)
{
HAL_SPI_IRQHandler(spi_handle);
}