Mercurial > public > ostc4
annotate Discovery/Src/ostc.c @ 921:eb4109d7d1e9 Evo_2_23
Improved mix mode ADC conversion:
Activity of UART sensors may have an impact to ADC measurement. To avoid the ADC trigger was moved into a time window ~300ms after last UART command request => After UART sensor performed measurement but before next measurement is requested. In addition the general ADC measurement cycle has been changed to one second to avoid jitter in the value updates on the display.
author | Ideenmodellierer |
---|---|
date | Sun, 03 Nov 2024 18:19:51 +0100 |
parents | 8d3f3a635397 |
children |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/ostc.c | |
5 /// \brief Hardware specific configuration | |
6 /// \author Heinrichs Weikamp gmbh | |
7 /// \date 05-Dec-2014 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include "ostc.h" | |
31 #include "stm32f4xx_hal.h" | |
32 | |
33 #ifndef BOOTLOADER_STANDALONE | |
34 #include "tCCR.h" | |
35 #endif | |
36 | |
37 /* Exported variables --------------------------------------------------------*/ | |
38 SPI_HandleTypeDef hspiDisplay; | |
39 SPI_HandleTypeDef cpu2DmaSpi; | |
40 | |
41 | |
42 UART_HandleTypeDef UartHandle; | |
300
5ca177d2df5d
cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents:
140
diff
changeset
|
43 #ifdef USART_PIEZO |
38 | 44 UART_HandleTypeDef UartPiezoTxHandle; |
300
5ca177d2df5d
cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents:
140
diff
changeset
|
45 #endif |
38 | 46 UART_HandleTypeDef UartIR_HUD_Handle; |
47 | |
48 __IO ITStatus UartReady = RESET; | |
870 | 49 __IO ITStatus UartReadyHUD = RESET; |
38 | 50 |
51 /* Private types -------------------------------------------------------------*/ | |
52 | |
53 /* Private variables ---------------------------------------------------------*/ | |
54 | |
55 /* Private variables with external access via get_xxx() function -------------*/ | |
885
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
56 static uint8_t hardwareDisplay = 0; //< either OSTC4 LCD (=0) or new Screen (=1) |
38 | 57 /* Private function prototypes -----------------------------------------------*/ |
58 | |
59 /* Exported functions --------------------------------------------------------*/ | |
60 | |
61 /** SPI init function | |
62 * called from HAL | |
63 */ | |
64 void MX_SPI_Init(void) | |
65 { | |
66 hspiDisplay.Instance = SPI5; | |
67 hspiDisplay.Init.Mode = SPI_MODE_MASTER; | |
68 hspiDisplay.Init.Direction = SPI_DIRECTION_2LINES; | |
69 hspiDisplay.Init.DataSize = SPI_DATASIZE_8BIT; | |
70 hspiDisplay.Init.CLKPolarity = SPI_POLARITY_LOW; | |
71 hspiDisplay.Init.CLKPhase = SPI_PHASE_1EDGE; | |
72 hspiDisplay.Init.NSS = SPI_NSS_SOFT; | |
73 hspiDisplay.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;//SPI_BAUDRATEPRESCALER_4;//SPI_BAUDRATEPRESCALER_256; | |
74 hspiDisplay.Init.FirstBit = SPI_FIRSTBIT_MSB; | |
75 hspiDisplay.Init.TIMode = SPI_TIMODE_DISABLED; | |
76 hspiDisplay.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED; | |
77 HAL_SPI_Init(&hspiDisplay); | |
78 | |
79 cpu2DmaSpi.Instance = SPI1; | |
80 cpu2DmaSpi.Init.Mode = SPI_MODE_MASTER; | |
81 cpu2DmaSpi.Init.Direction = SPI_DIRECTION_2LINES; | |
82 cpu2DmaSpi.Init.DataSize = SPI_DATASIZE_8BIT; | |
83 cpu2DmaSpi.Init.CLKPolarity = SPI_POLARITY_LOW; | |
84 cpu2DmaSpi.Init.CLKPhase = SPI_PHASE_1EDGE; | |
85 cpu2DmaSpi.Init.NSS = SPI_NSS_SOFT;//SPI_NSS_HARD_OUTPUT;//SPI_NSS_SOFT; | |
140
f6c52eb0e25d
Increase prescalar => frame takes about 4ms.
Ideenmodellierer
parents:
104
diff
changeset
|
86 cpu2DmaSpi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_128; |
38 | 87 cpu2DmaSpi.Init.FirstBit = SPI_FIRSTBIT_MSB; |
88 cpu2DmaSpi.Init.TIMode = SPI_TIMODE_DISABLED; | |
89 cpu2DmaSpi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED; | |
90 cpu2DmaSpi.Init.CRCPolynomial = 7; | |
91 | |
92 HAL_SPI_Init(&cpu2DmaSpi); | |
93 } | |
94 | |
870 | 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 | |
38 | 131 void MX_GPIO_Init(void) |
132 { | |
133 GPIO_InitTypeDef GPIO_InitStruct; | |
134 | |
135 DISPLAY_CSB_GPIO_ENABLE(); | |
136 DISPLAY_RESETB_GPIO_ENABLE(); | |
137 EXTFLASH_CSB_GPIO_ENABLE(); | |
138 SMALLCPU_CSB_GPIO_ENABLE(); | |
139 OSCILLOSCOPE_GPIO_ENABLE(); | |
140 OSCILLOSCOPE2_GPIO_ENABLE(); | |
879 | 141 BLE_UBLOX_DSR_GPIO_ENABLE(); |
38 | 142 |
143 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
144 GPIO_InitStruct.Pull = GPIO_PULLUP; | |
145 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | |
146 | |
147 GPIO_InitStruct.Pin = DISPLAY_CSB_PIN; | |
148 HAL_GPIO_Init(DISPLAY_CSB_GPIO_PORT, &GPIO_InitStruct); | |
149 | |
150 GPIO_InitStruct.Pin = DISPLAY_RESETB_PIN; | |
151 HAL_GPIO_Init(DISPLAY_RESETB_GPIO_PORT, &GPIO_InitStruct); | |
152 | |
153 GPIO_InitStruct.Pin = EXTFLASH_CSB_PIN; | |
154 HAL_GPIO_Init(EXTFLASH_CSB_GPIO_PORT, &GPIO_InitStruct); | |
155 | |
156 GPIO_InitStruct.Pin = OSCILLOSCOPE_PIN; | |
157 HAL_GPIO_Init(OSCILLOSCOPE_GPIO_PORT, &GPIO_InitStruct); | |
158 | |
159 GPIO_InitStruct.Pin = OSCILLOSCOPE2_PIN; | |
160 HAL_GPIO_Init(OSCILLOSCOPE2_GPIO_PORT, &GPIO_InitStruct); | |
161 | |
162 #ifdef DISPLAY_BACKLIGHT_PIN | |
163 DISPLAY_BACKLIGHT_GPIO_ENABLE(); | |
164 GPIO_InitStruct.Pin = DISPLAY_BACKLIGHT_PIN; | |
165 HAL_GPIO_Init(DISPLAY_BACKLIGHT_GPIO_PORT, &GPIO_InitStruct); | |
166 HAL_GPIO_WritePin(DISPLAY_BACKLIGHT_GPIO_PORT,DISPLAY_BACKLIGHT_PIN,GPIO_PIN_SET); | |
167 #endif | |
168 | |
169 #ifdef SMALLCPU_CSB_PIN | |
170 SMALLCPU_CSB_GPIO_ENABLE(); | |
171 GPIO_InitStruct.Pin = SMALLCPU_CSB_PIN; | |
172 HAL_GPIO_Init(SMALLCPU_CSB_GPIO_PORT, &GPIO_InitStruct); | |
173 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET); | |
174 #endif | |
175 | |
176 #ifdef SMALLCPU_BOOT0_PIN | |
177 GPIO_InitStruct.Pull = GPIO_NOPULL; | |
178 SMALLCPU_BOOT0_GPIO_ENABLE(); | |
179 GPIO_InitStruct.Pin = SMALLCPU_BOOT0_PIN; | |
180 HAL_GPIO_Init(SMALLCPU_BOOT0_GPIO_PORT, &GPIO_InitStruct); | |
181 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET); | |
182 GPIO_InitStruct.Pull = GPIO_PULLUP; | |
183 #endif | |
184 | |
185 #ifdef IR_HUD_ENABLE_PIN | |
186 IR_HUD_ENABLE_GPIO_ENABLE(); | |
187 GPIO_InitStruct.Pin = IR_HUD_ENABLE_PIN; | |
188 GPIO_InitStruct.Pull = GPIO_NOPULL; | |
189 HAL_GPIO_Init(IR_HUD_ENABLE_GPIO_PORT, &GPIO_InitStruct); | |
190 HAL_GPIO_WritePin(IR_HUD_ENABLE_GPIO_PORT,IR_HUD_ENABLE_PIN,GPIO_PIN_SET); | |
191 GPIO_InitStruct.Pull = GPIO_PULLUP; | |
192 #endif | |
193 | |
194 #ifdef BLE_NENABLE_PIN | |
195 BLE_NENABLE_GPIO_ENABLE(); | |
196 MX_Bluetooth_PowerOff(); | |
197 #endif | |
198 | |
199 #ifdef TESTPIN | |
200 GPIO_InitStruct.Pull = GPIO_PULLUP; | |
201 TEST_GPIO_ENABLE(); | |
202 GPIO_InitStruct.Pin = TEST_PIN; | |
203 HAL_GPIO_Init(TEST_GPIO_PORT, &GPIO_InitStruct); | |
204 HAL_GPIO_WritePin(TEST_GPIO_PORT,TEST_PIN,GPIO_PIN_SET); | |
205 GPIO_InitStruct.Pull = GPIO_PULLUP; | |
206 #endif | |
207 } | |
208 | |
209 | |
210 void MX_TestPin_High(void) | |
211 { | |
212 #ifdef TESTPIN | |
213 HAL_GPIO_WritePin(TEST_GPIO_PORT,TEST_PIN,GPIO_PIN_SET); | |
214 #endif | |
215 } | |
216 | |
217 | |
218 void MX_TestPin_Low(void) | |
219 { | |
220 #ifdef TESTPIN | |
221 HAL_GPIO_WritePin(TEST_GPIO_PORT,TEST_PIN,GPIO_PIN_RESET); | |
222 #endif | |
223 } | |
224 | |
225 void MX_Bluetooth_PowerOn(void) | |
226 { | |
227 GPIO_InitTypeDef GPIO_InitStruct; | |
228 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
229 GPIO_InitStruct.Pull = GPIO_NOPULL; | |
230 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | |
231 GPIO_InitStruct.Pin = BLE_NENABLE_PIN; | |
232 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct); | |
233 HAL_GPIO_WritePin(BLE_NENABLE_GPIO_PORT,BLE_NENABLE_PIN,GPIO_PIN_RESET); | |
879 | 234 |
235 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
236 GPIO_InitStruct.Pull = GPIO_PULLDOWN; | |
237 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | |
238 GPIO_InitStruct.Pin = BLE_UBLOX_DSR_PIN; | |
239 HAL_GPIO_Init(BLE_UBLOX_DSR_GPIO_PORT, &GPIO_InitStruct); | |
240 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET); | |
38 | 241 } |
242 | |
243 | |
244 void MX_Bluetooth_PowerOff(void) | |
245 { | |
246 GPIO_InitTypeDef GPIO_InitStruct; | |
247 GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | |
248 GPIO_InitStruct.Pin = BLE_NENABLE_PIN; | |
249 GPIO_InitStruct.Pull = GPIO_NOPULL; | |
250 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct); | |
879 | 251 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET); |
38 | 252 } |
253 | |
254 | |
255 void MX_SmallCPU_Reset_To_Boot(void) | |
256 { | |
257 #ifdef SMALLCPU_NRESET_PIN | |
258 GPIO_InitTypeDef GPIO_InitStruct; | |
259 | |
260 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
261 GPIO_InitStruct.Pull = GPIO_NOPULL; | |
262 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | |
263 | |
264 SMALLCPU_NRESET_GPIO_ENABLE(); | |
265 GPIO_InitStruct.Pin = SMALLCPU_NRESET_PIN; | |
266 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); | |
267 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_RESET); | |
268 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_SET); | |
269 HAL_Delay(2); | |
270 GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | |
271 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); | |
272 HAL_Delay(100); | |
273 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET); | |
274 #endif | |
275 } | |
276 | |
870 | 277 |
278 void MX_SmallCPU_NO_Reset_Helper(void) | |
279 { | |
280 #ifdef SMALLCPU_NRESET_PIN | |
281 GPIO_InitTypeDef GPIO_InitStruct; | |
282 | |
283 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
284 GPIO_InitStruct.Pull = GPIO_NOPULL; | |
285 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | |
286 | |
287 SMALLCPU_NRESET_GPIO_ENABLE(); | |
288 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); | |
289 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_SET); | |
290 // HAL_Delay(100); | |
291 // GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | |
292 // HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); | |
293 #endif | |
294 } | |
295 | |
296 | |
38 | 297 void MX_SmallCPU_Reset_To_Standard(void) |
298 { | |
299 #ifdef SMALLCPU_NRESET_PIN | |
300 GPIO_InitTypeDef GPIO_InitStruct; | |
301 | |
302 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
303 GPIO_InitStruct.Pull = GPIO_NOPULL; | |
304 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | |
305 | |
306 SMALLCPU_NRESET_GPIO_ENABLE(); | |
307 GPIO_InitStruct.Pin = SMALLCPU_NRESET_PIN; | |
308 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); | |
309 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_RESET); | |
310 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET); | |
311 HAL_Delay(2); | |
312 GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | |
313 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct); | |
314 #endif | |
315 } | |
316 | |
870 | 317 |
318 uint8_t MX_UART_ButtonAdjust(uint8_t *array) | |
319 { | |
320 #ifdef USART_PIEZO | |
321 uint8_t answer[4]; | |
322 HAL_UART_Transmit(&UartPiezoTxHandle,array,4,1000); | |
323 HAL_UART_Receive(&UartPiezoTxHandle,answer,4,2000); | |
324 if( (answer[0] == array[0]) | |
325 &&(answer[1] == array[1]) | |
326 &&(answer[2] == array[2]) | |
327 &&(answer[3] == array[3])) | |
328 return 1; | |
329 #endif | |
330 return 0; | |
331 } | |
332 | |
333 | |
38 | 334 void MX_UART_Init(void) |
335 { | |
336 /*##-1- Configure the UART peripheral ######################################*/ | |
337 /* Put the USART peripheral in the Asynchronous mode (UART Mode) */ | |
338 /* UART1 configured as follow: | |
339 - Word Length = 8 Bits | |
340 - Stop Bit = One Stop bit | |
341 - Parity = None | |
342 - BaudRate = 9600 baud | |
343 - Hardware flow control disabled (RTS and CTS signals) */ | |
344 | |
345 #ifdef USARTx_CTS_PIN | |
346 UartHandle.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS; | |
347 #else | |
348 UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; | |
349 #endif | |
350 UartHandle.Instance = USARTx; | |
351 UartHandle.Init.BaudRate = 115200; | |
352 UartHandle.Init.WordLength = UART_WORDLENGTH_8B; | |
353 UartHandle.Init.StopBits = UART_STOPBITS_1; | |
354 UartHandle.Init.Parity = UART_PARITY_NONE; | |
355 UartHandle.Init.Mode = UART_MODE_TX_RX; | |
356 HAL_UART_Init(&UartHandle); | |
357 | |
358 #ifdef USART_PIEZO | |
359 UartPiezoTxHandle.Instance = USART_PIEZO; | |
360 UartPiezoTxHandle.Init.BaudRate = 1200; | |
361 UartPiezoTxHandle.Init.WordLength = UART_WORDLENGTH_8B; | |
362 UartPiezoTxHandle.Init.StopBits = UART_STOPBITS_1; | |
363 UartPiezoTxHandle.Init.Parity = UART_PARITY_NONE; | |
364 UartPiezoTxHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; | |
365 UartPiezoTxHandle.Init.Mode = UART_MODE_TX_RX; | |
366 | |
367 HAL_UART_Init(&UartPiezoTxHandle); | |
368 #endif | |
369 | |
370 #ifdef USART_IR_HUD | |
371 UartIR_HUD_Handle.Instance = USART_IR_HUD; | |
372 UartIR_HUD_Handle.Init.BaudRate = 2400; | |
373 UartIR_HUD_Handle.Init.WordLength = UART_WORDLENGTH_8B; | |
374 UartIR_HUD_Handle.Init.StopBits = UART_STOPBITS_1; | |
375 UartIR_HUD_Handle.Init.Parity = UART_PARITY_NONE; | |
376 UartIR_HUD_Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE; | |
377 UartIR_HUD_Handle.Init.Mode = UART_MODE_TX_RX; | |
378 | |
379 HAL_UART_Init(&UartIR_HUD_Handle); | |
380 #endif | |
381 } | |
382 | |
383 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) | |
384 { | |
385 if(huart == &UartHandle) | |
386 UartReady = SET; | |
387 } | |
388 | |
321
37ee61f93124
Moved indication variable for received HUD data to tCCR file.
ideenmodellierer
parents:
300
diff
changeset
|
389 |
38 | 390 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) |
391 { | |
392 if(huart == &UartHandle) | |
393 UartReady = SET; | |
394 else | |
395 if(huart == &UartIR_HUD_Handle) | |
396 { | |
870 | 397 #ifndef BOOTLOADER_STANDALONE |
321
37ee61f93124
Moved indication variable for received HUD data to tCCR file.
ideenmodellierer
parents:
300
diff
changeset
|
398 tCCR_SetRXIndication(); |
870 | 399 #endif |
400 UartReadyHUD = SET; | |
38 | 401 } |
402 } | |
403 | |
404 void MX_tell_reset_logik_alles_ok(void) | |
405 { | |
406 #ifdef RESET_LOGIC_ALLES_OK_PIN | |
407 GPIO_InitTypeDef GPIO_InitStruct; | |
408 | |
409 RESET_LOGIC_ALLES_OK_GPIO_ENABLE(); | |
410 | |
411 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
412 GPIO_InitStruct.Pull = GPIO_NOPULL; | |
413 GPIO_InitStruct.Speed = GPIO_SPEED_LOW; | |
414 GPIO_InitStruct.Pin = RESET_LOGIC_ALLES_OK_PIN; | |
415 HAL_GPIO_Init(RESET_LOGIC_ALLES_OK_GPIO_PORT, &GPIO_InitStruct); | |
416 | |
417 HAL_GPIO_WritePin(RESET_LOGIC_ALLES_OK_GPIO_PORT,RESET_LOGIC_ALLES_OK_PIN,GPIO_PIN_RESET); | |
418 HAL_Delay(1); | |
419 HAL_GPIO_WritePin(RESET_LOGIC_ALLES_OK_GPIO_PORT,RESET_LOGIC_ALLES_OK_PIN,GPIO_PIN_SET); | |
420 | |
421 GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | |
422 HAL_GPIO_Init(RESET_LOGIC_ALLES_OK_GPIO_PORT, &GPIO_InitStruct); | |
423 #endif | |
424 } | |
885
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
425 void SetDisplayVersion(uint8_t version) |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
426 { |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
427 if(version < 2) |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
428 { |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
429 hardwareDisplay = version; |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
430 } |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
431 } |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
432 uint8_t isNewDisplay() |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
433 { |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
434 uint8_t ret = 0; |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
435 if(hardwareDisplay == DISPLAY_VERSION_NEW) |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
436 { |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
437 ret = 1; |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
438 } |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
439 return ret; |
8d3f3a635397
Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents:
879
diff
changeset
|
440 } |
38 | 441 |
442 #ifndef BOOTLOADER_STANDALONE | |
443 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) | |
444 { | |
445 if(huart == &UartIR_HUD_Handle) | |
446 tCCR_restart(); | |
447 } | |
448 #endif |