comparison Discovery/Src/ostc.c @ 870:bc6c90e20d9e Evo_2_23

Instrument code for Bootloader: the Bootloader was reactivated. Because some functions have changed in the past years an instrumentation had to be done to avoid compile issues (e.g. no multilanguage in Bootloader, no special fonts)
author Ideenmodellierer
date Mon, 12 Aug 2024 22:25:46 +0200
parents 37ee61f93124
children fe955104901c
comparison
equal deleted inserted replaced
869:4e10a3e087a1 870:bc6c90e20d9e
44 UART_HandleTypeDef UartPiezoTxHandle; 44 UART_HandleTypeDef UartPiezoTxHandle;
45 #endif 45 #endif
46 UART_HandleTypeDef UartIR_HUD_Handle; 46 UART_HandleTypeDef UartIR_HUD_Handle;
47 47
48 __IO ITStatus UartReady = RESET; 48 __IO ITStatus UartReady = RESET;
49 __IO ITStatus UartReadyHUD = RESET;
49 50
50 /* Private types -------------------------------------------------------------*/ 51 /* Private types -------------------------------------------------------------*/
51 52
52 /* Private variables ---------------------------------------------------------*/ 53 /* Private variables ---------------------------------------------------------*/
53 54
89 cpu2DmaSpi.Init.CRCPolynomial = 7; 90 cpu2DmaSpi.Init.CRCPolynomial = 7;
90 91
91 HAL_SPI_Init(&cpu2DmaSpi); 92 HAL_SPI_Init(&cpu2DmaSpi);
92 } 93 }
93 94
95
96 void MX_GPIO_Backlight_max_static_only_Init(void)
97 {
98 GPIO_InitTypeDef GPIO_InitStruct;
99 TIM_BACKLIGHT_GPIO_ENABLE();
100
101 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
102 GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
103 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
104
105 GPIO_InitStruct.Pin = TIM_BACKLIGHT_PIN;
106 HAL_GPIO_Init(TIM_BACKLIGHT_GPIO_PORT, &GPIO_InitStruct);
107
108 HAL_GPIO_WritePin(TIM_BACKLIGHT_GPIO_PORT,TIM_BACKLIGHT_PIN,GPIO_PIN_SET);
109 }
110
111
112 void MX_GPIO_One_Button_only_Init(void)
113 {
114 GPIO_InitTypeDef GPIO_InitStruct;
115 BUTTON_NEXT_GPIO_ENABLE();
116
117 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
118 GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
119 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
120
121 GPIO_InitStruct.Pin = BUTTON_NEXT_PIN;
122 HAL_GPIO_Init(BUTTON_NEXT_GPIO_PORT, &GPIO_InitStruct);
123 }
124
125
126 GPIO_PinState MX_GPIO_Read_The_One_Button(void)
127 {
128 return HAL_GPIO_ReadPin(BUTTON_NEXT_GPIO_PORT, BUTTON_NEXT_PIN);
129 }
130
94 void MX_GPIO_Init(void) 131 void MX_GPIO_Init(void)
95 { 132 {
96 GPIO_InitTypeDef GPIO_InitStruct; 133 GPIO_InitTypeDef GPIO_InitStruct;
97 134
98 DISPLAY_CSB_GPIO_ENABLE(); 135 DISPLAY_CSB_GPIO_ENABLE();
226 HAL_Delay(100); 263 HAL_Delay(100);
227 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET); 264 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET);
228 #endif 265 #endif
229 } 266 }
230 267
268
269 void MX_SmallCPU_NO_Reset_Helper(void)
270 {
271 #ifdef SMALLCPU_NRESET_PIN
272 GPIO_InitTypeDef GPIO_InitStruct;
273
274 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
275 GPIO_InitStruct.Pull = GPIO_NOPULL;
276 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
277
278 SMALLCPU_NRESET_GPIO_ENABLE();
279 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
280 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_SET);
281 // HAL_Delay(100);
282 // GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
283 // HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
284 #endif
285 }
286
287
231 void MX_SmallCPU_Reset_To_Standard(void) 288 void MX_SmallCPU_Reset_To_Standard(void)
232 { 289 {
233 #ifdef SMALLCPU_NRESET_PIN 290 #ifdef SMALLCPU_NRESET_PIN
234 GPIO_InitTypeDef GPIO_InitStruct; 291 GPIO_InitTypeDef GPIO_InitStruct;
235 292
246 GPIO_InitStruct.Mode = GPIO_MODE_INPUT; 303 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
247 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); 304 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
248 #endif 305 #endif
249 } 306 }
250 307
308
309 uint8_t MX_UART_ButtonAdjust(uint8_t *array)
310 {
311 #ifdef USART_PIEZO
312 uint8_t answer[4];
313 HAL_UART_Transmit(&UartPiezoTxHandle,array,4,1000);
314 HAL_UART_Receive(&UartPiezoTxHandle,answer,4,2000);
315 if( (answer[0] == array[0])
316 &&(answer[1] == array[1])
317 &&(answer[2] == array[2])
318 &&(answer[3] == array[3]))
319 return 1;
320 #endif
321 return 0;
322 }
323
324
251 void MX_UART_Init(void) 325 void MX_UART_Init(void)
252 { 326 {
253 /*##-1- Configure the UART peripheral ######################################*/ 327 /*##-1- Configure the UART peripheral ######################################*/
254 /* Put the USART peripheral in the Asynchronous mode (UART Mode) */ 328 /* Put the USART peripheral in the Asynchronous mode (UART Mode) */
255 /* UART1 configured as follow: 329 /* UART1 configured as follow:
309 if(huart == &UartHandle) 383 if(huart == &UartHandle)
310 UartReady = SET; 384 UartReady = SET;
311 else 385 else
312 if(huart == &UartIR_HUD_Handle) 386 if(huart == &UartIR_HUD_Handle)
313 { 387 {
388 #ifndef BOOTLOADER_STANDALONE
314 tCCR_SetRXIndication(); 389 tCCR_SetRXIndication();
390 #endif
391 UartReadyHUD = SET;
315 } 392 }
316 } 393 }
317 394
318 void MX_tell_reset_logik_alles_ok(void) 395 void MX_tell_reset_logik_alles_ok(void)
319 { 396 {