comparison Discovery/Src/ostc.c @ 300:5ca177d2df5d cleanup-4

cleanup: remove commented/unused code, make static without any functional change. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Fri, 17 May 2019 21:19:04 +0200
parents f6c52eb0e25d
children 37ee61f93124
comparison
equal deleted inserted replaced
299:b70c26be71a0 300:5ca177d2df5d
38 SPI_HandleTypeDef hspiDisplay; 38 SPI_HandleTypeDef hspiDisplay;
39 SPI_HandleTypeDef cpu2DmaSpi; 39 SPI_HandleTypeDef cpu2DmaSpi;
40 40
41 41
42 UART_HandleTypeDef UartHandle; 42 UART_HandleTypeDef UartHandle;
43 #ifdef USART_PIEZO
43 UART_HandleTypeDef UartPiezoTxHandle; 44 UART_HandleTypeDef UartPiezoTxHandle;
45 #endif
44 UART_HandleTypeDef UartIR_HUD_Handle; 46 UART_HandleTypeDef UartIR_HUD_Handle;
45 47
46 __IO ITStatus UartReady = RESET; 48 __IO ITStatus UartReady = RESET;
47 __IO ITStatus UartReadyHUD = RESET; 49 __IO ITStatus UartReadyHUD = RESET;
48 50
88 cpu2DmaSpi.Init.CRCPolynomial = 7; 90 cpu2DmaSpi.Init.CRCPolynomial = 7;
89 91
90 HAL_SPI_Init(&cpu2DmaSpi); 92 HAL_SPI_Init(&cpu2DmaSpi);
91 } 93 }
92 94
93
94 void MX_GPIO_Backlight_max_static_only_Init(void)
95 {
96 GPIO_InitTypeDef GPIO_InitStruct;
97 TIM_BACKLIGHT_GPIO_ENABLE();
98
99 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
100 GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
101 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
102
103 GPIO_InitStruct.Pin = TIM_BACKLIGHT_PIN;
104 HAL_GPIO_Init(TIM_BACKLIGHT_GPIO_PORT, &GPIO_InitStruct);
105
106 HAL_GPIO_WritePin(TIM_BACKLIGHT_GPIO_PORT,TIM_BACKLIGHT_PIN,GPIO_PIN_SET);
107 }
108
109
110 void MX_GPIO_One_Button_only_Init(void)
111 {
112 GPIO_InitTypeDef GPIO_InitStruct;
113 BUTTON_NEXT_GPIO_ENABLE();
114
115 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
116 GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
117 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
118
119 GPIO_InitStruct.Pin = BUTTON_NEXT_PIN;
120 HAL_GPIO_Init(BUTTON_NEXT_GPIO_PORT, &GPIO_InitStruct);
121 }
122
123
124 GPIO_PinState MX_GPIO_Read_The_One_Button(void)
125 {
126 return HAL_GPIO_ReadPin(BUTTON_NEXT_GPIO_PORT, BUTTON_NEXT_PIN);
127 }
128
129 void MX_GPIO_Init(void) 95 void MX_GPIO_Init(void)
130 { 96 {
131 GPIO_InitTypeDef GPIO_InitStruct; 97 GPIO_InitTypeDef GPIO_InitStruct;
132 98
133 DISPLAY_CSB_GPIO_ENABLE(); 99 DISPLAY_CSB_GPIO_ENABLE();
261 HAL_Delay(100); 227 HAL_Delay(100);
262 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET); 228 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET);
263 #endif 229 #endif
264 } 230 }
265 231
266
267 void MX_SmallCPU_NO_Reset_Helper(void)
268 {
269 #ifdef SMALLCPU_NRESET_PIN
270 GPIO_InitTypeDef GPIO_InitStruct;
271
272 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
273 GPIO_InitStruct.Pull = GPIO_NOPULL;
274 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
275
276 SMALLCPU_NRESET_GPIO_ENABLE();
277 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
278 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_SET);
279 // HAL_Delay(100);
280 // GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
281 // HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
282 #endif
283 }
284
285
286 void MX_SmallCPU_Reset_To_Standard(void) 232 void MX_SmallCPU_Reset_To_Standard(void)
287 { 233 {
288 #ifdef SMALLCPU_NRESET_PIN 234 #ifdef SMALLCPU_NRESET_PIN
289 GPIO_InitTypeDef GPIO_InitStruct; 235 GPIO_InitTypeDef GPIO_InitStruct;
290 236
301 GPIO_InitStruct.Mode = GPIO_MODE_INPUT; 247 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
302 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); 248 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
303 #endif 249 #endif
304 } 250 }
305 251
306
307 uint8_t MX_UART_ButtonAdjust(uint8_t *array)
308 {
309 #ifdef USART_PIEZO
310 uint8_t answer[4];
311 HAL_UART_Transmit(&UartPiezoTxHandle,array,4,1000);
312 HAL_UART_Receive(&UartPiezoTxHandle,answer,4,2000);
313 if( (answer[0] == array[0])
314 &&(answer[1] == array[1])
315 &&(answer[2] == array[2])
316 &&(answer[3] == array[3]))
317 return 1;
318 #endif
319 return 0;
320 }
321
322
323 void MX_UART_Init(void) 252 void MX_UART_Init(void)
324 { 253 {
325 /*##-1- Configure the UART peripheral ######################################*/ 254 /*##-1- Configure the UART peripheral ######################################*/
326 /* Put the USART peripheral in the Asynchronous mode (UART Mode) */ 255 /* Put the USART peripheral in the Asynchronous mode (UART Mode) */
327 /* UART1 configured as follow: 256 /* UART1 configured as follow:
373 { 302 {
374 if(huart == &UartHandle) 303 if(huart == &UartHandle)
375 UartReady = SET; 304 UartReady = SET;
376 } 305 }
377 306
378
379
380 //void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) 307 //void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
381 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) 308 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
382 { 309 {
383 if(huart == &UartHandle) 310 if(huart == &UartHandle)
384 UartReady = SET; 311 UartReady = SET;