Mercurial > public > ostc4
comparison Small_CPU/Src/baseCPU2.c @ 917:0d6c4b40fae4 Evo_2_23
Bugfix external interface power up after sleep:
The previous implementation did not consider if the external power was enabled of not before sleep (the power was later enabled by sensor handling). The power is now activated immediatly after leaving sleep in order to aoid delays in sensor startup.
author | Ideenmodellierer |
---|---|
date | Sun, 03 Nov 2024 15:37:00 +0100 |
parents | 6902bb4b6b2e |
children | 7c996354b8ac |
comparison
equal
deleted
inserted
replaced
916:4832981f9af8 | 917:0d6c4b40fae4 |
---|---|
289 #ifdef DEBUG_RUNTIME | 289 #ifdef DEBUG_RUNTIME |
290 RTC_TimeTypeDef Stime; | 290 RTC_TimeTypeDef Stime; |
291 uint8_t measurementindex = 0; | 291 uint8_t measurementindex = 0; |
292 uint8_t lastsecond = 0xFF; | 292 uint8_t lastsecond = 0xFF; |
293 #endif | 293 #endif |
294 | |
295 uint8_t extInterfaceActive = 0; | |
294 | 296 |
295 HAL_Init(); | 297 HAL_Init(); |
296 SystemClock_Config(); | 298 SystemClock_Config(); |
297 | 299 |
298 HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000); | 300 HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000); |
539 global.mode = MODE_SLEEP; | 541 global.mode = MODE_SLEEP; |
540 MX_SPI3_Init(); | 542 MX_SPI3_Init(); |
541 break; | 543 break; |
542 | 544 |
543 case MODE_SLEEP: | 545 case MODE_SLEEP: |
546 extInterfaceActive = externalInterface_isEnabledPower33(); | |
544 externalInterface_SwitchUART(EXT_INTERFACE_UART_OFF); | 547 externalInterface_SwitchUART(EXT_INTERFACE_UART_OFF); |
545 externalInterface_SwitchPower33(false); | 548 externalInterface_SwitchPower33(false); |
546 if (hasExternalClock()) | 549 if (hasExternalClock()) |
547 SystemClock_Config_HSI(); | 550 SystemClock_Config_HSI(); |
548 GPIO_LEDs_VIBRATION_Init(); | 551 GPIO_LEDs_VIBRATION_Init(); |
560 SPI_synchronize_with_Master(); | 563 SPI_synchronize_with_Master(); |
561 MX_DMA_Init(); | 564 MX_DMA_Init(); |
562 MX_SPI1_Init(); | 565 MX_SPI1_Init(); |
563 SPI_Start_single_TxRx_with_Master(); | 566 SPI_Start_single_TxRx_with_Master(); |
564 | 567 |
565 if(externalInterface_isEnabledPower33()) | 568 if(extInterfaceActive) |
566 { | 569 { |
567 externalInterface_SwitchPower33(true); | 570 externalInterface_SwitchPower33(true); |
568 } | 571 } |
569 externalInterface_InitDatastruct(); | 572 externalInterface_InitDatastruct(); |
570 // EXTILine0_Button_DeInit(); not now, later after testing | 573 // EXTILine0_Button_DeInit(); not now, later after testing |