Mercurial > public > ostc4
comparison Small_CPU/Src/baseCPU2.c @ 903:0f2e5a166d40 Evo_2_23
Disable GNSS operations using compile switch:
GNSS IO operation caused the RTE to not switch into sleep mode in case of wrong HW version => Operations have been disabled by inactive ENABLE_GNSS compile switch
| author | Ideenmodellierer |
|---|---|
| date | Thu, 03 Oct 2024 20:25:49 +0200 |
| parents | 6a7701f66b16 |
| children | 6902bb4b6b2e |
comparison
equal
deleted
inserted
replaced
| 902:d4622533271d | 903:0f2e5a166d40 |
|---|---|
| 233 | 233 |
| 234 static void GPIO_LEDs_VIBRATION_Init(void); | 234 static void GPIO_LEDs_VIBRATION_Init(void); |
| 235 static void GPIO_Power_MainCPU_Init(void); | 235 static void GPIO_Power_MainCPU_Init(void); |
| 236 static void GPIO_Power_MainCPU_ON(void); | 236 static void GPIO_Power_MainCPU_ON(void); |
| 237 static void GPIO_Power_MainCPU_OFF(void); | 237 static void GPIO_Power_MainCPU_OFF(void); |
| 238 #ifdef ENABLE_GNSS | |
| 238 static void GPIO_LED_RED_OFF(void); | 239 static void GPIO_LED_RED_OFF(void); |
| 239 static void GPIO_LED_RED_ON(void); | 240 static void GPIO_LED_RED_ON(void); |
| 240 static void GPIO_LED_GREEN_OFF(void); | 241 static void GPIO_LED_GREEN_OFF(void); |
| 241 static void GPIO_LED_GREEN_ON(void); | 242 static void GPIO_LED_GREEN_ON(void); |
| 242 static void GPIO_VIBRATION_OFF(void); | 243 static void GPIO_VIBRATION_OFF(void); |
| 243 static void GPIO_VIBRATION_ON(void); | 244 static void GPIO_VIBRATION_ON(void); |
| 244 static void GPIO_GPS_OFF(void); | 245 static void GPIO_GPS_OFF(void); |
| 245 static void GPIO_GPS_ON(void); | 246 static void GPIO_GPS_ON(void); |
| 246 static void GPIO_GPS_BCKP_OFF(void); | 247 static void GPIO_GPS_BCKP_OFF(void); |
| 247 static void GPIO_GPS_BCKP_ON(void); | 248 static void GPIO_GPS_BCKP_ON(void); |
| 248 | 249 #endif |
| 249 #ifdef DEBUG_I2C_LINES | 250 #ifdef DEBUG_I2C_LINES |
| 250 void GPIO_test_I2C_lines(void); | 251 void GPIO_test_I2C_lines(void); |
| 251 #endif | 252 #endif |
| 252 | 253 |
| 253 void sleep_prepare(void); | 254 void sleep_prepare(void); |
| 407 accelerator_init(); | 408 accelerator_init(); |
| 408 externalInterface_Init(); | 409 externalInterface_Init(); |
| 409 | 410 |
| 410 if (global.mode == MODE_BOOT) { | 411 if (global.mode == MODE_BOOT) { |
| 411 GPIO_Power_MainCPU_OFF(); | 412 GPIO_Power_MainCPU_OFF(); |
| 412 | 413 #ifdef ENABLE_GNSS |
| 413 GPIO_LED_GREEN_ON(); | 414 GPIO_LED_GREEN_ON(); |
| 415 #endif | |
| 414 HAL_Delay(100); // for GPIO_Power_MainCPU_ON(); | 416 HAL_Delay(100); // for GPIO_Power_MainCPU_ON(); |
| 415 GPIO_Power_MainCPU_ON(); | 417 GPIO_Power_MainCPU_ON(); |
| 416 | 418 #ifdef ENABLE_GNSS |
| 417 GPIO_LED_GREEN_OFF(); | 419 GPIO_LED_GREEN_OFF(); |
| 418 | 420 |
| 419 GPIO_LED_RED_ON(); | 421 GPIO_LED_RED_ON(); |
| 420 GPIO_VIBRATION_ON(); | 422 GPIO_VIBRATION_ON(); |
| 423 #endif | |
| 421 HAL_Delay(100); | 424 HAL_Delay(100); |
| 425 #ifdef ENABLE_GNSS | |
| 422 GPIO_LED_RED_OFF(); | 426 GPIO_LED_RED_OFF(); |
| 423 GPIO_VIBRATION_OFF(); | 427 GPIO_VIBRATION_OFF(); |
| 428 #endif | |
| 424 } | 429 } |
| 430 #ifdef ENABLE_GNSS | |
| 425 GPIO_LED_RED_OFF(); | 431 GPIO_LED_RED_OFF(); |
| 426 GPIO_LED_GREEN_OFF(); | 432 GPIO_LED_GREEN_OFF(); |
| 427 GPIO_VIBRATION_OFF(); | 433 GPIO_VIBRATION_OFF(); |
| 434 #endif | |
| 428 SPI_synchronize_with_Master(); | 435 SPI_synchronize_with_Master(); |
| 429 MX_DMA_Init(); | 436 MX_DMA_Init(); |
| 430 MX_SPI1_Init(); | 437 MX_SPI1_Init(); |
| 431 SPI_Start_single_TxRx_with_Master(); /* be prepared for the first data exchange */ | 438 SPI_Start_single_TxRx_with_Master(); /* be prepared for the first data exchange */ |
| 432 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD); | 439 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD); |
| 883 | 890 |
| 884 static void GPIO_Power_MainCPU_OFF(void) { | 891 static void GPIO_Power_MainCPU_OFF(void) { |
| 885 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_SET); | 892 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_SET); |
| 886 } | 893 } |
| 887 | 894 |
| 895 #ifdef ENABLE_GNSS | |
| 888 static void GPIO_LED_GREEN_ON(void) { | 896 static void GPIO_LED_GREEN_ON(void) { |
| 889 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_GREEN, GPIO_PIN_RESET); | 897 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_GREEN, GPIO_PIN_RESET); |
| 890 } | 898 } |
| 891 | 899 |
| 892 static void GPIO_LED_GREEN_OFF(void) { | 900 static void GPIO_LED_GREEN_OFF(void) { |
| 922 } | 930 } |
| 923 | 931 |
| 924 static void GPIO_GPS_BCKP_OFF(void) { | 932 static void GPIO_GPS_BCKP_OFF(void) { |
| 925 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_RESET); | 933 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_RESET); |
| 926 } | 934 } |
| 927 | 935 #endif |
| 928 | 936 |
| 929 /** | 937 /** |
| 930 * @brief Configures EXTI Line0 (connected to PA0 + PA1 pin) in interrupt mode | 938 * @brief Configures EXTI Line0 (connected to PA0 + PA1 pin) in interrupt mode |
| 931 * @param None | 939 * @param None |
| 932 * @retval None | 940 * @retval None |
| 1028 | 1036 |
| 1029 GPIO_InitStruct.Pin = GPIO_PIN_All; | 1037 GPIO_InitStruct.Pin = GPIO_PIN_All; |
| 1030 HAL_GPIO_Init( GPIOH, &GPIO_InitStruct); | 1038 HAL_GPIO_Init( GPIOH, &GPIO_InitStruct); |
| 1031 | 1039 |
| 1032 GPIO_Power_MainCPU_OFF(); | 1040 GPIO_Power_MainCPU_OFF(); |
| 1041 #ifdef ENABLE_GNSS | |
| 1033 GPIO_LED_GREEN_OFF(); | 1042 GPIO_LED_GREEN_OFF(); |
| 1034 GPIO_LED_RED_OFF(); | 1043 GPIO_LED_RED_OFF(); |
| 1035 GPIO_VIBRATION_OFF(); | 1044 GPIO_VIBRATION_OFF(); |
| 1036 GPIO_GPS_BCKP_ON(); // mH : costs 100µA in sleep - beware | 1045 GPIO_GPS_BCKP_ON(); // mH : costs 100µA in sleep - beware |
| 1037 GPIO_GPS_OFF(); | 1046 GPIO_GPS_OFF(); |
| 1038 | 1047 |
| 1039 MX_USART6_UART_DeInit(); | 1048 MX_USART6_UART_DeInit(); |
| 1040 | 1049 #endif |
| 1041 #ifndef DEBUGMODE | 1050 #ifndef DEBUGMODE |
| 1042 __HAL_RCC_GPIOB_CLK_DISABLE(); | 1051 __HAL_RCC_GPIOB_CLK_DISABLE(); |
| 1043 #endif | 1052 #endif |
| 1044 __HAL_RCC_GPIOH_CLK_DISABLE(); | 1053 __HAL_RCC_GPIOH_CLK_DISABLE(); |
| 1045 | 1054 |
