Fix missing magic in SPI driver

This commit is contained in:
Mario Hüttel 2021-01-02 23:03:22 +01:00
parent 82cab98f59
commit 6e3f90d38e

View File

@ -104,6 +104,7 @@ stm_spi_handle spi_init(struct stm_spi_dev *spi_dev_struct, SPI_TypeDef *spi_reg
ret_handle = spi_dev_struct; ret_handle = spi_dev_struct;
spi_dev_struct->settings.cs_deactivate(); spi_dev_struct->settings.cs_deactivate();
spi_dev_struct->magic = STM_SPI_DEV_MAGIC;
exit: exit:
return ret_handle; return ret_handle;
@ -118,6 +119,8 @@ void spi_deinit(stm_spi_handle handle)
if (!dev) if (!dev)
return; return;
dev->magic = 0UL;
dev->spi_regs->CR1 = 0; dev->spi_regs->CR1 = 0;
dev->spi_regs->CR2 = 0; dev->spi_regs->CR2 = 0;