1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-25 07:58:12 +00:00

fix(core): fix tropic driver deinitialization

[no changelog]
This commit is contained in:
cepetr 2025-04-07 15:20:07 +02:00 committed by cepetr
parent 47d1378d28
commit ad80d5c1de
2 changed files with 7 additions and 2 deletions

View File

@ -145,7 +145,10 @@ bool tropic_hal_init(void) {
void tropic_hal_deinit(void) {
tropic01_hal_driver_t *drv = &g_tropic01_hal_driver;
HAL_SPI_DeInit(&drv->spi);
if (drv->spi.Instance != NULL) {
HAL_SPI_DeInit(&drv->spi);
}
__HAL_RCC_SPI2_FORCE_RESET();
__HAL_RCC_SPI2_RELEASE_RESET();
__HAL_RCC_SPI2_CLK_DISABLE();

View File

@ -94,7 +94,9 @@ cleanup:
void tropic_deinit(void) {
tropic_driver_t *drv = &g_tropic_driver;
lt_deinit(&drv->handle);
if (drv->handle.device != NULL) {
lt_deinit(&drv->handle);
}
tropic_hal_deinit();