annotate Discovery/Src/ostc.c @ 1045:b018e1f3082e GasConsumption

Deactivate OSTC5 BT init sequence: At the moment the OSTC BT is preconfigurated and starting in data mode => skip BT config in case a OSTC5 HW is detected
author Ideenmodellierer
date Mon, 03 Nov 2025 21:17:14 +0100
parents 5865f0aeb438
children 1d7c7a36df15
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
1036
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
50 #ifdef ENABLE_USART_RADIO
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
51 UART_HandleTypeDef UartRadio_Handle;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
52 #endif
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
53
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 __IO ITStatus UartReady = RESET;
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
55 __IO ITStatus UartReadyHUD = RESET;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 /* Private variables with external access via get_xxx() function -------------*/
885
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
62 static uint8_t hardwareDisplay = 0; //< either OSTC4 LCD (=0) or new Screen (=1)
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
63
1036
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
64 #ifdef ENABLE_PULSE_SENSOR_BT
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
65 static DMA_HandleTypeDef hdma_uart_BT_rx;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
66 #endif
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
67
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
68 #ifdef ENABLE_USART_RADIO
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
69 static DMA_HandleTypeDef hdma_uart_radio_rx;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
70 #endif
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
71
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
72 static uint16_t rxBufRead = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
73 static uint16_t rxBufWrite = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
74 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
75
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 /** SPI init function
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 * called from HAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 void MX_SPI_Init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 hspiDisplay.Instance = SPI5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 hspiDisplay.Init.Mode = SPI_MODE_MASTER;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 hspiDisplay.Init.Direction = SPI_DIRECTION_2LINES;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 hspiDisplay.Init.DataSize = SPI_DATASIZE_8BIT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 hspiDisplay.Init.CLKPolarity = SPI_POLARITY_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 hspiDisplay.Init.CLKPhase = SPI_PHASE_1EDGE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 hspiDisplay.Init.NSS = SPI_NSS_SOFT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 hspiDisplay.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;//SPI_BAUDRATEPRESCALER_4;//SPI_BAUDRATEPRESCALER_256;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 hspiDisplay.Init.FirstBit = SPI_FIRSTBIT_MSB;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 hspiDisplay.Init.TIMode = SPI_TIMODE_DISABLED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 hspiDisplay.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 HAL_SPI_Init(&hspiDisplay);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 cpu2DmaSpi.Instance = SPI1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 cpu2DmaSpi.Init.Mode = SPI_MODE_MASTER;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 cpu2DmaSpi.Init.Direction = SPI_DIRECTION_2LINES;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 cpu2DmaSpi.Init.DataSize = SPI_DATASIZE_8BIT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 cpu2DmaSpi.Init.CLKPolarity = SPI_POLARITY_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 cpu2DmaSpi.Init.CLKPhase = SPI_PHASE_1EDGE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 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
105 cpu2DmaSpi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_128;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 cpu2DmaSpi.Init.FirstBit = SPI_FIRSTBIT_MSB;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 cpu2DmaSpi.Init.TIMode = SPI_TIMODE_DISABLED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 cpu2DmaSpi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 cpu2DmaSpi.Init.CRCPolynomial = 7;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 HAL_SPI_Init(&cpu2DmaSpi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
114
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
115 void MX_GPIO_Backlight_max_static_only_Init(void)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
116 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
117 GPIO_InitTypeDef GPIO_InitStruct;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
118 TIM_BACKLIGHT_GPIO_ENABLE();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
119
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
120 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
121 GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
122 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
123
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
124 GPIO_InitStruct.Pin = TIM_BACKLIGHT_PIN;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
125 HAL_GPIO_Init(TIM_BACKLIGHT_GPIO_PORT, &GPIO_InitStruct);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
126
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
127 HAL_GPIO_WritePin(TIM_BACKLIGHT_GPIO_PORT,TIM_BACKLIGHT_PIN,GPIO_PIN_SET);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
128 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
129
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
130
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
131 void MX_GPIO_One_Button_only_Init(void)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
132 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
133 GPIO_InitTypeDef GPIO_InitStruct;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
134 BUTTON_NEXT_GPIO_ENABLE();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
135
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
136 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
137 GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
138 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
139
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
140 GPIO_InitStruct.Pin = BUTTON_NEXT_PIN;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
141 HAL_GPIO_Init(BUTTON_NEXT_GPIO_PORT, &GPIO_InitStruct);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
142 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
143
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
144
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
145 GPIO_PinState MX_GPIO_Read_The_One_Button(void)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
146 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
147 return HAL_GPIO_ReadPin(BUTTON_NEXT_GPIO_PORT, BUTTON_NEXT_PIN);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
148 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
149
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 void MX_GPIO_Init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 DISPLAY_CSB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 DISPLAY_RESETB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 EXTFLASH_CSB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 SMALLCPU_CSB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 OSCILLOSCOPE_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 OSCILLOSCOPE2_GPIO_ENABLE();
879
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
160 BLE_UBLOX_DSR_GPIO_ENABLE();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 GPIO_InitStruct.Pin = DISPLAY_CSB_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 HAL_GPIO_Init(DISPLAY_CSB_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 GPIO_InitStruct.Pin = DISPLAY_RESETB_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 HAL_GPIO_Init(DISPLAY_RESETB_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 GPIO_InitStruct.Pin = EXTFLASH_CSB_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 HAL_GPIO_Init(EXTFLASH_CSB_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 GPIO_InitStruct.Pin = OSCILLOSCOPE_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 HAL_GPIO_Init(OSCILLOSCOPE_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 GPIO_InitStruct.Pin = OSCILLOSCOPE2_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 HAL_GPIO_Init(OSCILLOSCOPE2_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 #ifdef DISPLAY_BACKLIGHT_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 DISPLAY_BACKLIGHT_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 GPIO_InitStruct.Pin = DISPLAY_BACKLIGHT_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 HAL_GPIO_Init(DISPLAY_BACKLIGHT_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 HAL_GPIO_WritePin(DISPLAY_BACKLIGHT_GPIO_PORT,DISPLAY_BACKLIGHT_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 #ifdef SMALLCPU_CSB_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 SMALLCPU_CSB_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 GPIO_InitStruct.Pin = SMALLCPU_CSB_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 HAL_GPIO_Init(SMALLCPU_CSB_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 #ifdef SMALLCPU_BOOT0_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 SMALLCPU_BOOT0_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 GPIO_InitStruct.Pin = SMALLCPU_BOOT0_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 HAL_GPIO_Init(SMALLCPU_BOOT0_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 #ifdef IR_HUD_ENABLE_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 IR_HUD_ENABLE_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 GPIO_InitStruct.Pin = IR_HUD_ENABLE_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 HAL_GPIO_Init(IR_HUD_ENABLE_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 HAL_GPIO_WritePin(IR_HUD_ENABLE_GPIO_PORT,IR_HUD_ENABLE_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 #ifdef BLE_NENABLE_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 BLE_NENABLE_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 MX_Bluetooth_PowerOff();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 #ifdef TESTPIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 TEST_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 GPIO_InitStruct.Pin = TEST_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 HAL_GPIO_Init(TEST_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 HAL_GPIO_WritePin(TEST_GPIO_PORT,TEST_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 GPIO_InitStruct.Pull = GPIO_PULLUP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 void MX_TestPin_High(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 #ifdef TESTPIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 HAL_GPIO_WritePin(TEST_GPIO_PORT,TEST_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 void MX_TestPin_Low(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 #ifdef TESTPIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 HAL_GPIO_WritePin(TEST_GPIO_PORT,TEST_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 void MX_Bluetooth_PowerOn(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 GPIO_InitStruct.Pin = BLE_NENABLE_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 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
253
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
254 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
255 GPIO_InitStruct.Pull = GPIO_PULLDOWN;
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
256 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
257 GPIO_InitStruct.Pin = BLE_UBLOX_DSR_PIN;
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
258 HAL_GPIO_Init(BLE_UBLOX_DSR_GPIO_PORT, &GPIO_InitStruct);
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
259 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
260 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 void MX_Bluetooth_PowerOff(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 GPIO_InitStruct.Pin = BLE_NENABLE_PIN;
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 HAL_GPIO_Init(BLE_NENABLE_GPIO_PORT, &GPIO_InitStruct);
879
fe955104901c new bluetooth work, bootloader work
heinrichsweikamp
parents: 870
diff changeset
270 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
271 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 void MX_SmallCPU_Reset_To_Boot(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 #ifdef SMALLCPU_NRESET_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 SMALLCPU_NRESET_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 GPIO_InitStruct.Pin = SMALLCPU_NRESET_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_SET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 HAL_Delay(2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 HAL_Delay(100);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
296
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
297 void MX_SmallCPU_NO_Reset_Helper(void)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
298 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
299 #ifdef SMALLCPU_NRESET_PIN
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
300 GPIO_InitTypeDef GPIO_InitStruct;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
301
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
302 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
303 GPIO_InitStruct.Pull = GPIO_NOPULL;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
304 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
305
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
306 SMALLCPU_NRESET_GPIO_ENABLE();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
307 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
308 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_SET);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
309 // HAL_Delay(100);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
310 // GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
311 // HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
312 #endif
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
313 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
314
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
315
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 void MX_SmallCPU_Reset_To_Standard(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 #ifdef SMALLCPU_NRESET_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 SMALLCPU_NRESET_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 GPIO_InitStruct.Pin = SMALLCPU_NRESET_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 HAL_GPIO_WritePin(SMALLCPU_BOOT0_GPIO_PORT,SMALLCPU_BOOT0_PIN,GPIO_PIN_RESET);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 HAL_Delay(2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
336
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
337 uint8_t MX_UART_ButtonAdjust(uint8_t *array)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
338 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
339 #ifdef USART_PIEZO
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
340 uint8_t answer[4];
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
341 HAL_UART_Transmit(&UartPiezoTxHandle,array,4,1000);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
342 HAL_UART_Receive(&UartPiezoTxHandle,answer,4,2000);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
343 if( (answer[0] == array[0])
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
344 &&(answer[1] == array[1])
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
345 &&(answer[2] == array[2])
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
346 &&(answer[3] == array[3]))
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
347 return 1;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
348 #endif
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
349 return 0;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
350 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
351
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
352
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 void MX_UART_Init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 /*##-1- Configure the UART peripheral ######################################*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 /* Put the USART peripheral in the Asynchronous mode (UART Mode) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 /* UART1 configured as follow:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 - Word Length = 8 Bits
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 - Stop Bit = One Stop bit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 - Parity = None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 - BaudRate = 9600 baud
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 - Hardware flow control disabled (RTS and CTS signals) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 #ifdef USARTx_CTS_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 UartHandle.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 #else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 UartHandle.Instance = USARTx;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 UartHandle.Init.BaudRate = 115200;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 UartHandle.Init.StopBits = UART_STOPBITS_1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 UartHandle.Init.Parity = UART_PARITY_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 UartHandle.Init.Mode = UART_MODE_TX_RX;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 HAL_UART_Init(&UartHandle);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 #ifdef USART_PIEZO
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 UartPiezoTxHandle.Instance = USART_PIEZO;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 UartPiezoTxHandle.Init.BaudRate = 1200;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 UartPiezoTxHandle.Init.WordLength = UART_WORDLENGTH_8B;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 UartPiezoTxHandle.Init.StopBits = UART_STOPBITS_1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 UartPiezoTxHandle.Init.Parity = UART_PARITY_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 UartPiezoTxHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 UartPiezoTxHandle.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(&UartPiezoTxHandle);
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 #ifdef USART_IR_HUD
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 UartIR_HUD_Handle.Instance = USART_IR_HUD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 UartIR_HUD_Handle.Init.BaudRate = 2400;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 UartIR_HUD_Handle.Init.WordLength = UART_WORDLENGTH_8B;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 UartIR_HUD_Handle.Init.StopBits = UART_STOPBITS_1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 UartIR_HUD_Handle.Init.Parity = UART_PARITY_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 UartIR_HUD_Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 UartIR_HUD_Handle.Init.Mode = UART_MODE_TX_RX;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 HAL_UART_Init(&UartIR_HUD_Handle);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 #endif
1036
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
400
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
401 #ifdef ENABLE_USART_RADIO
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
402 UartRadio_Handle.Instance = USART_RADIO;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
403 UartRadio_Handle.Init.BaudRate = 9600;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
404 UartRadio_Handle.Init.WordLength = UART_WORDLENGTH_8B;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
405 UartRadio_Handle.Init.StopBits = UART_STOPBITS_1;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
406 UartRadio_Handle.Init.Parity = UART_PARITY_NONE;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
407 UartRadio_Handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
408 UartRadio_Handle.Init.Mode = UART_MODE_RX;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
409
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
410 HAL_UART_Init(&UartRadio_Handle);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
411 #endif
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
412
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414
1036
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
415 #ifdef ENABLE_PULSE_SENSOR_BT
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
416 void MX_UART_BT_Init_DMA()
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
417 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
418
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
419 __DMA2_CLK_ENABLE();
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
420 __HAL_RCC_DMA2_CLK_ENABLE();
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
421
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
422 hdma_uart_BT_rx.Instance = DMA2_Stream2;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
423 hdma_uart_BT_rx.Init.Channel = DMA_CHANNEL_4;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
424 hdma_uart_BT_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
425 hdma_uart_BT_rx.Init.PeriphInc = DMA_PINC_DISABLE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
426 hdma_uart_BT_rx.Init.MemInc = DMA_MINC_ENABLE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
427 hdma_uart_BT_rx.Init.PeriphDataAlignment = DMA_MDATAALIGN_BYTE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
428 hdma_uart_BT_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
429 hdma_uart_BT_rx.Init.Mode = DMA_NORMAL;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
430 hdma_uart_BT_rx.Init.Priority = DMA_PRIORITY_LOW;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
431 hdma_uart_BT_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
432 HAL_DMA_Init(&hdma_uart_BT_rx);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
433
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
434 __HAL_LINKDMA(&UartHandle, hdmarx, hdma_uart_BT_rx);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
435
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
436 HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, 0, 0);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
437 HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
438 }
1036
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
439 #endif
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
440
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
441 #ifdef ENABLE_USART_RADIO
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
442 void MX_UART_RADIO_Init_DMA()
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
443 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
444
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
445 __DMA2_CLK_ENABLE();
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
446 __HAL_RCC_DMA2_CLK_ENABLE();
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
447
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
448 hdma_uart_radio_rx.Instance = DMA2_Stream1;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
449 hdma_uart_radio_rx.Init.Channel = DMA_CHANNEL_4;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
450 hdma_uart_radio_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
451 hdma_uart_radio_rx.Init.PeriphInc = DMA_PINC_DISABLE;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
452 hdma_uart_radio_rx.Init.MemInc = DMA_MINC_ENABLE;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
453 hdma_uart_radio_rx.Init.PeriphDataAlignment = DMA_MDATAALIGN_BYTE;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
454 hdma_uart_radio_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
455 hdma_uart_radio_rx.Init.Mode = DMA_NORMAL;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
456 hdma_uart_radio_rx.Init.Priority = DMA_PRIORITY_LOW;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
457 hdma_uart_radio_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
458 HAL_DMA_Init(&hdma_uart_radio_rx);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
459
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
460 __HAL_LINKDMA(&UartRadio_Handle, hdmarx, hdma_uart_radio_rx);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
461
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
462 HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 0, 0);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
463 HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
464 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
465 #endif
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
466
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
467
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
468 uint8_t UART_getChar()
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
469 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
470 uint8_t retChar = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
471
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
472 if((rxBufRead != rxBufWrite) && (rxBufferUart[rxBufRead] != 0))
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
473 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
474 retChar = rxBufferUart[rxBufRead];
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
475 rxBufferUart[rxBufRead++] = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
476 if(rxBufRead == CHUNK_SIZE * CHUNKS_PER_BUFFER)
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
477 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
478 rxBufRead = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
479 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
480 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
481 return retChar;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
482 }
1036
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
483 #ifdef ENABLE_PULSE_SENSOR_BT
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
484 void UART_StartDMARx()
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
485 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
486 HAL_UART_Receive_DMA (&UartHandle, &rxBufferUart[rxBufWrite], CHUNK_SIZE);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
487 rxBufWrite += CHUNK_SIZE;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
488 if(rxBufWrite >= CHUNK_SIZE * CHUNKS_PER_BUFFER)
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
489 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
490 rxBufWrite = 0;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
491 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
492 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
493 void DMA2_Stream2_IRQHandler(void)
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
494 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
495 HAL_DMA_IRQHandler(&hdma_uart_BT_rx);
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
496 }
1036
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
497 #endif
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
498
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
499 #ifdef ENABLE_USART_RADIO
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
500 void UART_StartDMARxRadio()
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
501 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
502 HAL_UART_Receive_DMA (&UartRadio_Handle, &rxBufferUart[rxBufWrite], CHUNK_SIZE);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
503 rxBufWrite += CHUNK_SIZE;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
504 if(rxBufWrite >= CHUNK_SIZE * CHUNKS_PER_BUFFER)
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
505 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
506 rxBufWrite = 0;
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
507 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
508 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
509
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
510 void DMA2_Stream2_IRQHandler(void)
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
511 {
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
512 HAL_DMA_IRQHandler(&hdma_uart_radio_rx);
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
513 }
5865f0aeb438 Radio data integration:
Ideenmodellierer
parents: 1032
diff changeset
514 #endif
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
515
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 if(huart == &UartHandle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 UartReady = SET;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521
321
37ee61f93124 Moved indication variable for received HUD data to tCCR file.
ideenmodellierer
parents: 300
diff changeset
522
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 if(huart == &UartHandle)
1032
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
526 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
527 #ifdef ENABLE_PULSE_SENSOR_BT
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
528 if(cv_heartbeat_getState() != SENSOR_HB_OFFLINE)
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
529 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
530 UART_StartDMARx();
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
531 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
532 else
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
533 {
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
534 UartReady = SET;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
535 }
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
536 #else
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
537 UartReady = SET;
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
538 #endif
33b91584d827 New CV Pulse:
Ideenmodellierer
parents: 885
diff changeset
539 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 if(huart == &UartIR_HUD_Handle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542 {
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
543 #ifndef BOOTLOADER_STANDALONE
321
37ee61f93124 Moved indication variable for received HUD data to tCCR file.
ideenmodellierer
parents: 300
diff changeset
544 tCCR_SetRXIndication();
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
545 #endif
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 321
diff changeset
546 UartReadyHUD = SET;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 void MX_tell_reset_logik_alles_ok(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 #ifdef RESET_LOGIC_ALLES_OK_PIN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 GPIO_InitTypeDef GPIO_InitStruct;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 RESET_LOGIC_ALLES_OK_GPIO_ENABLE();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 GPIO_InitStruct.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 GPIO_InitStruct.Pin = RESET_LOGIC_ALLES_OK_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 HAL_GPIO_Init(RESET_LOGIC_ALLES_OK_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 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
564 HAL_Delay(1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 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
566
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 HAL_GPIO_Init(RESET_LOGIC_ALLES_OK_GPIO_PORT, &GPIO_InitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 }
885
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
571 void SetDisplayVersion(uint8_t version)
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
572 {
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
573 if(version < 2)
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
574 {
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
575 hardwareDisplay = version;
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
576 }
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
577 }
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
578 uint8_t isNewDisplay()
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
579 {
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
580 uint8_t ret = 0;
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
581 if(hardwareDisplay == DISPLAY_VERSION_NEW)
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
582 {
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
583 ret = 1;
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
584 }
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
585 return ret;
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 879
diff changeset
586 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 #ifndef BOOTLOADER_STANDALONE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 if(huart == &UartIR_HUD_Handle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 tCCR_restart();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 #endif