Mercurial > public > ostc4
comparison Small_CPU/Src/gpio.c @ 988:d9290c76b840 GasConsumption
OSTC4/5 joined code:
In the previous version code differences between OSTC4/5 were identified using the ENABLE_GPIO_V2 compiler switch. In the new version this is done using the display version as indicator which OSTC model is in used. Since this is detected by Firmware the information is forwarded from there to the RTE. This causes a little delay in the GPIO initialization but this applies only to the cold start of the RTE which should not happen very often.
author | ideenmodellierer |
---|---|
date | Sun, 06 Apr 2025 21:02:17 +0200 (2 weeks ago) |
parents | e9c37071933b |
children |
comparison
equal
deleted
inserted
replaced
984:41136649b90d | 988:d9290c76b840 |
---|---|
23 | 23 |
24 #include "stm32f4xx_hal.h" | 24 #include "stm32f4xx_hal.h" |
25 #include "gpio.h" | 25 #include "gpio.h" |
26 #include "data_exchange.h" | 26 #include "data_exchange.h" |
27 #include "scheduler.h" | 27 #include "scheduler.h" |
28 #include "uart_internal.h" | |
29 #include "GNSS.h" | |
28 | 30 |
29 /* Exported variables --------------------------------------------------------*/ | 31 /* Exported variables --------------------------------------------------------*/ |
30 /* Private variables ---------------------------------------------------------*/ | 32 /* Private variables ---------------------------------------------------------*/ |
31 | 33 static uint8_t GPIO_Version = 0; |
32 /* Private types -------------------------------------------------------------*/ | 34 /* Private types -------------------------------------------------------------*/ |
33 | 35 |
34 /* Private function prototypes -----------------------------------------------*/ | 36 /* Private function prototypes -----------------------------------------------*/ |
35 | 37 |
36 /* Exported functions --------------------------------------------------------*/ | 38 /* Exported functions --------------------------------------------------------*/ |
89 GPIO_InitStructure.Speed = GPIO_SPEED_LOW; | 91 GPIO_InitStructure.Speed = GPIO_SPEED_LOW; |
90 HAL_GPIO_Init( GPIOC, &GPIO_InitStructure); | 92 HAL_GPIO_Init( GPIOC, &GPIO_InitStructure); |
91 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); | 93 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); |
92 } | 94 } |
93 | 95 |
94 #ifdef ENABLE_GPIO_V2 | |
95 void GPIO_HandleBuzzer() | 96 void GPIO_HandleBuzzer() |
96 { | 97 { |
97 static uint32_t buzzerOnTick = 0; | 98 static uint32_t buzzerOnTick = 0; |
98 static uint8_t buzzerWasOn = 0; | 99 static uint8_t buzzerWasOn = 0; |
99 | 100 |
122 /* GPIO_LED_RED_OFF(); */ | 123 /* GPIO_LED_RED_OFF(); */ |
123 } | 124 } |
124 buzzerWasOn = 0; | 125 buzzerWasOn = 0; |
125 } | 126 } |
126 } | 127 } |
127 #endif | 128 |
128 void GPIO_Power_MainCPU_ON(void) { | 129 void GPIO_Power_MainCPU_ON(void) { |
129 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); | 130 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); |
130 } | 131 } |
131 | 132 |
132 void GPIO_Power_MainCPU_OFF(void) { | 133 void GPIO_Power_MainCPU_OFF(void) { |
133 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_SET); | 134 HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_SET); |
134 } | 135 } |
135 | 136 |
136 #ifdef ENABLE_GPIO_V2 | |
137 void GPIO_LED_GREEN_ON(void) { | 137 void GPIO_LED_GREEN_ON(void) { |
138 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_GREEN, GPIO_PIN_RESET); | 138 HAL_GPIO_WritePin( GPIOA, LED_CONTROL_PIN_GREEN, GPIO_PIN_RESET); |
139 } | 139 } |
140 | 140 |
141 void GPIO_LED_GREEN_OFF(void) { | 141 void GPIO_LED_GREEN_OFF(void) { |
171 } | 171 } |
172 | 172 |
173 void GPIO_GPS_BCKP_OFF(void) { | 173 void GPIO_GPS_BCKP_OFF(void) { |
174 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_RESET); | 174 HAL_GPIO_WritePin( GPIOB, GPS_BCKP_CONTROL_PIN, GPIO_PIN_RESET); |
175 } | 175 } |
176 | |
177 uint8_t GPIO_GetVersion() | |
178 { | |
179 return GPIO_Version; | |
180 } | |
181 | |
182 void GPIO_Activate_V2(void) | |
183 { | |
184 GPIO_Version = 1; | |
185 GPIO_LEDs_VIBRATION_Init(); | |
186 | |
187 #ifdef ENABLE_GNSS_INTERN | |
188 GNSS_IO_init(); | |
189 GPIO_GPS_ON(); | |
190 GPIO_GPS_BCKP_ON(); | |
191 MX_USART6_UART_Init(); | |
192 GNSS_Init(&GNSS_Handle, &huart6); | |
176 #endif | 193 #endif |
177 | 194 } |
178 /* Private functions ---------------------------------------------------------*/ | 195 /* Private functions ---------------------------------------------------------*/ |
179 | 196 |
180 | 197 |
181 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ | 198 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |