annotate Discovery/Src/ostc.c @ 1032:33b91584d827 Puls_Integration

New CV Pulse: The basic infrastructure for external puls measurement via Bluetooth has been added. Precondition is an OSTC with an activated central role. The OSTC will then search for a BLE device with puls measurement service. Reading data and visualization is not implemented yet.
author Ideenmodellierer
date Mon, 28 Jul 2025 18:34:45 +0200
parents 8d3f3a635397
children 5865f0aeb438
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/ostc.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Hardware specific configuration
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 05-Dec-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
30 #include "configuration.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 #include "ostc.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "stm32f4xx_hal.h"
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
33 #include "cv_heartbeat.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #ifndef BOOTLOADER_STANDALONE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #include "tCCR.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 /* Exported variables --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 SPI_HandleTypeDef hspiDisplay;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 SPI_HandleTypeDef cpu2DmaSpi;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 UART_HandleTypeDef UartHandle;
300
5ca177d2df5d cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents: 140
diff changeset
45 #ifdef USART_PIEZO
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 UART_HandleTypeDef UartPiezoTxHandle;
300
5ca177d2df5d cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents: 140
diff changeset
47 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 UART_HandleTypeDef UartIR_HUD_Handle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 __IO ITStatus UartReady = RESET;
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
51 __IO ITStatus UartReadyHUD = RESET;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 /* Private variables with external access via get_xxx() function -------------*/
885
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
58 static uint8_t hardwareDisplay = 0; //< either OSTC4 LCD (=0) or new Screen (=1)
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
59
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
60 static uint16_t rxBufRead = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
61 static uint16_t rxBufWrite = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
62 static uint8_t rxBufferUart[CHUNK_SIZE * CHUNKS_PER_BUFFER]; /* The complete buffer has a X * chunk size to allow variations in buffer read time */
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
63
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 /** SPI init function
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 * called from HAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 void MX_SPI_Init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 hspiDisplay.Instance = SPI5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 hspiDisplay.Init.Mode = SPI_MODE_MASTER;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 hspiDisplay.Init.Direction = SPI_DIRECTION_2LINES;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 hspiDisplay.Init.DataSize = SPI_DATASIZE_8BIT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 hspiDisplay.Init.CLKPolarity = SPI_POLARITY_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 hspiDisplay.Init.CLKPhase = SPI_PHASE_1EDGE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 hspiDisplay.Init.NSS = SPI_NSS_SOFT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 hspiDisplay.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;//SPI_BAUDRATEPRESCALER_4;//SPI_BAUDRATEPRESCALER_256;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 hspiDisplay.Init.FirstBit = SPI_FIRSTBIT_MSB;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 hspiDisplay.Init.TIMode = SPI_TIMODE_DISABLED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 hspiDisplay.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 HAL_SPI_Init(&hspiDisplay);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 cpu2DmaSpi.Instance = SPI1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 cpu2DmaSpi.Init.Mode = SPI_MODE_MASTER;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 cpu2DmaSpi.Init.Direction = SPI_DIRECTION_2LINES;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 cpu2DmaSpi.Init.DataSize = SPI_DATASIZE_8BIT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 cpu2DmaSpi.Init.CLKPolarity = SPI_POLARITY_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 cpu2DmaSpi.Init.CLKPhase = SPI_PHASE_1EDGE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 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
93 cpu2DmaSpi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_128;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 cpu2DmaSpi.Init.FirstBit = SPI_FIRSTBIT_MSB;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 cpu2DmaSpi.Init.TIMode = SPI_TIMODE_DISABLED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 cpu2DmaSpi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 cpu2DmaSpi.Init.CRCPolynomial = 7;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 HAL_SPI_Init(&cpu2DmaSpi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
102
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
103 void MX_GPIO_Backlight_max_static_only_Init(void)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
104 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
105 GPIO_InitTypeDef GPIO_InitStruct;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
106 TIM_BACKLIGHT_GPIO_ENABLE();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
107
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
108 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
109 GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
110 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
111
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
112 GPIO_InitStruct.Pin = TIM_BACKLIGHT_PIN;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
113 HAL_GPIO_Init(TIM_BACKLIGHT_GPIO_PORT, &GPIO_InitStruct);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
114
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
115 HAL_GPIO_WritePin(TIM_BACKLIGHT_GPIO_PORT,TIM_BACKLIGHT_PIN,GPIO_PIN_SET);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
116 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
117
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
118
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
119 void MX_GPIO_One_Button_only_Init(void)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
120 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
121 GPIO_InitTypeDef GPIO_InitStruct;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
122 BUTTON_NEXT_GPIO_ENABLE();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
123
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
124 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
125 GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
126 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
127
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
128 GPIO_InitStruct.Pin = BUTTON_NEXT_PIN;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
129 HAL_GPIO_Init(BUTTON_NEXT_GPIO_PORT, &GPIO_InitStruct);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
130 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
131
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
132
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
133 GPIO_PinState MX_GPIO_Read_The_One_Button(void)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
134 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
135 return HAL_GPIO_ReadPin(BUTTON_NEXT_GPIO_PORT, BUTTON_NEXT_PIN);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
136 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
137
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 void MX_GPIO_Init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 DISPLAY_CSB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 DISPLAY_RESETB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 EXTFLASH_CSB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 SMALLCPU_CSB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 OSCILLOSCOPE_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 OSCILLOSCOPE2_GPIO_ENABLE();
879
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
148 BLE_UBLOX_DSR_GPIO_ENABLE();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 GPIO_InitStruct.Pin = DISPLAY_CSB_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 HAL_GPIO_Init(DISPLAY_CSB_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 GPIO_InitStruct.Pin = DISPLAY_RESETB_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 HAL_GPIO_Init(DISPLAY_RESETB_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 GPIO_InitStruct.Pin = EXTFLASH_CSB_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 HAL_GPIO_Init(EXTFLASH_CSB_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 GPIO_InitStruct.Pin = OSCILLOSCOPE_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 HAL_GPIO_Init(OSCILLOSCOPE_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 GPIO_InitStruct.Pin = OSCILLOSCOPE2_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 HAL_GPIO_Init(OSCILLOSCOPE2_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 #ifdef DISPLAY_BACKLIGHT_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 DISPLAY_BACKLIGHT_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 GPIO_InitStruct.Pin = DISPLAY_BACKLIGHT_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 HAL_GPIO_Init(DISPLAY_BACKLIGHT_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 HAL_GPIO_WritePin(DISPLAY_BACKLIGHT_GPIO_PORT,DISPLAY_BACKLIGHT_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 #ifdef SMALLCPU_CSB_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 SMALLCPU_CSB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 GPIO_InitStruct.Pin = SMALLCPU_CSB_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 HAL_GPIO_Init(SMALLCPU_CSB_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 #ifdef SMALLCPU_BOOT0_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 SMALLCPU_BOOT0_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 GPIO_InitStruct.Pin = SMALLCPU_BOOT0_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 HAL_GPIO_Init(SMALLCPU_BOOT0_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 #ifdef IR_HUD_ENABLE_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 IR_HUD_ENABLE_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 GPIO_InitStruct.Pin = IR_HUD_ENABLE_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 HAL_GPIO_Init(IR_HUD_ENABLE_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 HAL_GPIO_WritePin(IR_HUD_ENABLE_GPIO_PORT,IR_HUD_ENABLE_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 #ifdef BLE_NENABLE_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 BLE_NENABLE_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 MX_Bluetooth_PowerOff();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 #ifdef TESTPIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 TEST_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 GPIO_InitStruct.Pin = TEST_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 HAL_GPIO_Init(TEST_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 HAL_GPIO_WritePin(TEST_GPIO_PORT,TEST_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 void MX_TestPin_High(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 #ifdef TESTPIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 HAL_GPIO_WritePin(TEST_GPIO_PORT,TEST_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 void MX_TestPin_Low(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 #ifdef TESTPIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 HAL_GPIO_WritePin(TEST_GPIO_PORT,TEST_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 void MX_Bluetooth_PowerOn(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 GPIO_InitStruct.Pin = BLE_NENABLE_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 HAL_GPIO_WritePin(BLE_NENABLE_GPIO_PORT,BLE_NENABLE_PIN,GPIO_PIN_RESET);
879
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
241
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
242 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
243 GPIO_InitStruct.Pull = GPIO_PULLDOWN;
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
244 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
245 GPIO_InitStruct.Pin = BLE_UBLOX_DSR_PIN;
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
246 HAL_GPIO_Init(BLE_UBLOX_DSR_GPIO_PORT, &GPIO_InitStruct);
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
247 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 void MX_Bluetooth_PowerOff(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 GPIO_InitStruct.Pin = BLE_NENABLE_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct);
879
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
258 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 void MX_SmallCPU_Reset_To_Boot(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 #ifdef SMALLCPU_NRESET_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 SMALLCPU_NRESET_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 GPIO_InitStruct.Pin = SMALLCPU_NRESET_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 HAL_Delay(2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 HAL_Delay(100);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
284
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
285 void MX_SmallCPU_NO_Reset_Helper(void)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
286 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
287 #ifdef SMALLCPU_NRESET_PIN
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
288 GPIO_InitTypeDef GPIO_InitStruct;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
289
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
290 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
291 GPIO_InitStruct.Pull = GPIO_NOPULL;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
292 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
293
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
294 SMALLCPU_NRESET_GPIO_ENABLE();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
295 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
296 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_SET);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
297 // HAL_Delay(100);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
298 // GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
299 // HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
300 #endif
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
301 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
302
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
303
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 void MX_SmallCPU_Reset_To_Standard(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 #ifdef SMALLCPU_NRESET_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 SMALLCPU_NRESET_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 GPIO_InitStruct.Pin = SMALLCPU_NRESET_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 HAL_Delay(2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
324
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
325 uint8_t MX_UART_ButtonAdjust(uint8_t *array)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
326 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
327 #ifdef USART_PIEZO
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
328 uint8_t answer[4];
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
329 HAL_UART_Transmit(&UartPiezoTxHandle,array,4,1000);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
330 HAL_UART_Receive(&UartPiezoTxHandle,answer,4,2000);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
331 if( (answer[0] == array[0])
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
332 &&(answer[1] == array[1])
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
333 &&(answer[2] == array[2])
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
334 &&(answer[3] == array[3]))
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
335 return 1;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
336 #endif
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
337 return 0;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
338 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
339
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
340
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 void MX_UART_Init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 /*##-1- Configure the UART peripheral ######################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 /* Put the USART peripheral in the Asynchronous mode (UART Mode) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 /* UART1 configured as follow:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 - Word Length = 8 Bits
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 - Stop Bit = One Stop bit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 - Parity = None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 - BaudRate = 9600 baud
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 - Hardware flow control disabled (RTS and CTS signals) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 #ifdef USARTx_CTS_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 UartHandle.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 #else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 UartHandle.Instance = USARTx;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 UartHandle.Init.BaudRate = 115200;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 UartHandle.Init.StopBits = UART_STOPBITS_1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 UartHandle.Init.Parity = UART_PARITY_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 UartHandle.Init.Mode = UART_MODE_TX_RX;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 HAL_UART_Init(&UartHandle);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 #ifdef USART_PIEZO
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 UartPiezoTxHandle.Instance = USART_PIEZO;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 UartPiezoTxHandle.Init.BaudRate = 1200;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 UartPiezoTxHandle.Init.WordLength = UART_WORDLENGTH_8B;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 UartPiezoTxHandle.Init.StopBits = UART_STOPBITS_1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 UartPiezoTxHandle.Init.Parity = UART_PARITY_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 UartPiezoTxHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 UartPiezoTxHandle.Init.Mode = UART_MODE_TX_RX;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 HAL_UART_Init(&UartPiezoTxHandle);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 #ifdef USART_IR_HUD
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 UartIR_HUD_Handle.Instance = USART_IR_HUD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 UartIR_HUD_Handle.Init.BaudRate = 2400;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 UartIR_HUD_Handle.Init.WordLength = UART_WORDLENGTH_8B;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 UartIR_HUD_Handle.Init.StopBits = UART_STOPBITS_1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 UartIR_HUD_Handle.Init.Parity = UART_PARITY_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 UartIR_HUD_Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 UartIR_HUD_Handle.Init.Mode = UART_MODE_TX_RX;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 HAL_UART_Init(&UartIR_HUD_Handle);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
390 static DMA_HandleTypeDef hdma_uart_BT_rx;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
391
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
392 void MX_UART_BT_Init_DMA()
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
393 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
394
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
395 __DMA2_CLK_ENABLE();
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
396 __HAL_RCC_DMA2_CLK_ENABLE();
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
397
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
398 hdma_uart_BT_rx.Instance = DMA2_Stream2;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
399 hdma_uart_BT_rx.Init.Channel = DMA_CHANNEL_4;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
400 hdma_uart_BT_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
401 hdma_uart_BT_rx.Init.PeriphInc = DMA_PINC_DISABLE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
402 hdma_uart_BT_rx.Init.MemInc = DMA_MINC_ENABLE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
403 hdma_uart_BT_rx.Init.PeriphDataAlignment = DMA_MDATAALIGN_BYTE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
404 hdma_uart_BT_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
405 hdma_uart_BT_rx.Init.Mode = DMA_NORMAL;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
406 hdma_uart_BT_rx.Init.Priority = DMA_PRIORITY_LOW;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
407 hdma_uart_BT_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
408 HAL_DMA_Init(&hdma_uart_BT_rx);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
409
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
410 __HAL_LINKDMA(&UartHandle, hdmarx, hdma_uart_BT_rx);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
411
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
412 HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, 0, 0);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
413 HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
414 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
415
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
416
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
417 uint8_t UART_getChar()
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
418 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
419 uint8_t retChar = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
420
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
421 if((rxBufRead != rxBufWrite) && (rxBufferUart[rxBufRead] != 0))
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
422 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
423 retChar = rxBufferUart[rxBufRead];
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
424 rxBufferUart[rxBufRead++] = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
425 if(rxBufRead == CHUNK_SIZE * CHUNKS_PER_BUFFER)
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
426 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
427 rxBufRead = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
428 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
429 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
430 return retChar;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
431 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
432
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
433 void UART_StartDMARx()
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
434 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
435 HAL_UART_Receive_DMA (&UartHandle, &rxBufferUart[rxBufWrite], CHUNK_SIZE);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
436 rxBufWrite += CHUNK_SIZE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
437 if(rxBufWrite >= CHUNK_SIZE * CHUNKS_PER_BUFFER)
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
438 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
439 rxBufWrite = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
440 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
441 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
442
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
443 void DMA2_Stream2_IRQHandler(void)
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
444 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
445 HAL_DMA_IRQHandler(&hdma_uart_BT_rx);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
446 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
447
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 if(huart == &UartHandle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 UartReady = SET;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453
321
37ee61f93124 Moved indication variable for received HUD data to tCCR file.
ideenmodellierer
parents: 300
diff changeset
454
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 if(huart == &UartHandle)
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
458 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
459 #ifdef ENABLE_PULSE_SENSOR_BT
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
460 if(cv_heartbeat_getState() != SENSOR_HB_OFFLINE)
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
461 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
462 UART_StartDMARx();
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
463 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
464 else
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
465 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
466 UartReady = SET;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
467 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
468 #else
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
469 UartReady = SET;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
470 #endif
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
471 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 if(huart == &UartIR_HUD_Handle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 {
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
475 #ifndef BOOTLOADER_STANDALONE
321
37ee61f93124 Moved indication variable for received HUD data to tCCR file.
ideenmodellierer
parents: 300
diff changeset
476 tCCR_SetRXIndication();
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
477 #endif
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
478 UartReadyHUD = SET;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 void MX_tell_reset_logik_alles_ok(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 #ifdef RESET_LOGIC_ALLES_OK_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 RESET_LOGIC_ALLES_OK_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 GPIO_InitStruct.Pin = RESET_LOGIC_ALLES_OK_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 HAL_GPIO_Init(RESET_LOGIC_ALLES_OK_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 HAL_GPIO_WritePin(RESET_LOGIC_ALLES_OK_GPIO_PORT,RESET_LOGIC_ALLES_OK_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 HAL_Delay(1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 HAL_GPIO_WritePin(RESET_LOGIC_ALLES_OK_GPIO_PORT,RESET_LOGIC_ALLES_OK_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 HAL_GPIO_Init(RESET_LOGIC_ALLES_OK_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 }
885
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
503 void SetDisplayVersion(uint8_t version)
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
504 {
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
505 if(version < 2)
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
506 {
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
507 hardwareDisplay = version;
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
508 }
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
509 }
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
510 uint8_t isNewDisplay()
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
511 {
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
512 uint8_t ret = 0;
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
513 if(hardwareDisplay == DISPLAY_VERSION_NEW)
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
514 {
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
515 ret = 1;
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
516 }
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
517 return ret;
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
518 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 #ifndef BOOTLOADER_STANDALONE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 if(huart == &UartIR_HUD_Handle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 tCCR_restart();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 #endif