diff Discovery/Src/ostc.c @ 870:bc6c90e20d9e Evo_2_23

Instrument code for Bootloader: the Bootloader was reactivated. Because some functions have changed in the past years an instrumentation had to be done to avoid compile issues (e.g. no multilanguage in Bootloader, no special fonts)
author Ideenmodellierer
date Mon, 12 Aug 2024 22:25:46 +0200
parents 37ee61f93124
children fe955104901c
line wrap: on
line diff
--- a/Discovery/Src/ostc.c	Mon Aug 12 22:23:03 2024 +0200
+++ b/Discovery/Src/ostc.c	Mon Aug 12 22:25:46 2024 +0200
@@ -46,6 +46,7 @@
 UART_HandleTypeDef UartIR_HUD_Handle;
 
 __IO ITStatus UartReady = RESET;
+__IO ITStatus UartReadyHUD = RESET;
 
 /* Private types -------------------------------------------------------------*/
 
@@ -91,6 +92,42 @@
     HAL_SPI_Init(&cpu2DmaSpi);
 }
 
+
+void MX_GPIO_Backlight_max_static_only_Init(void)
+{
+    GPIO_InitTypeDef GPIO_InitStruct;
+    TIM_BACKLIGHT_GPIO_ENABLE();
+
+    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+    GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
+    GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
+
+    GPIO_InitStruct.Pin = TIM_BACKLIGHT_PIN;
+    HAL_GPIO_Init(TIM_BACKLIGHT_GPIO_PORT, &GPIO_InitStruct);
+
+    HAL_GPIO_WritePin(TIM_BACKLIGHT_GPIO_PORT,TIM_BACKLIGHT_PIN,GPIO_PIN_SET);
+}
+
+
+void MX_GPIO_One_Button_only_Init(void)
+{
+    GPIO_InitTypeDef GPIO_InitStruct;
+    BUTTON_NEXT_GPIO_ENABLE();
+
+    GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+    GPIO_InitStruct.Pull = GPIO_NOPULL;//GPIO_PULLUP; /* should be normally high */
+    GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
+
+    GPIO_InitStruct.Pin = BUTTON_NEXT_PIN;
+    HAL_GPIO_Init(BUTTON_NEXT_GPIO_PORT, &GPIO_InitStruct);
+}
+
+
+GPIO_PinState MX_GPIO_Read_The_One_Button(void)
+{
+    return HAL_GPIO_ReadPin(BUTTON_NEXT_GPIO_PORT, BUTTON_NEXT_PIN);
+}
+
 void MX_GPIO_Init(void)
 {
     GPIO_InitTypeDef GPIO_InitStruct;
@@ -228,6 +265,26 @@
 #endif
 }
 
+
+void MX_SmallCPU_NO_Reset_Helper(void)
+{
+#ifdef SMALLCPU_NRESET_PIN
+    GPIO_InitTypeDef GPIO_InitStruct;
+
+    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+    GPIO_InitStruct.Pull = GPIO_NOPULL;
+    GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
+
+    SMALLCPU_NRESET_GPIO_ENABLE();
+    HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
+    HAL_GPIO_WritePin(SMALLCPU_NRESET_GPIO_PORT,SMALLCPU_NRESET_PIN,GPIO_PIN_SET);
+//	HAL_Delay(100);
+//  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+//  HAL_GPIO_Init(SMALLCPU_NRESET_GPIO_PORT, &GPIO_InitStruct);
+#endif
+}
+
+
 void MX_SmallCPU_Reset_To_Standard(void)
 {
 #ifdef SMALLCPU_NRESET_PIN
@@ -248,6 +305,23 @@
 #endif
 }
 
+
+uint8_t MX_UART_ButtonAdjust(uint8_t *array)
+{
+#ifdef USART_PIEZO
+    uint8_t answer[4];
+    HAL_UART_Transmit(&UartPiezoTxHandle,array,4,1000);
+    HAL_UART_Receive(&UartPiezoTxHandle,answer,4,2000);
+    if(	(answer[0] == array[0])
+        &&(answer[1] == array[1])
+        &&(answer[2] == array[2])
+        &&(answer[3] == array[3]))
+    return 1;
+#endif
+    return 0;
+}
+
+
 void MX_UART_Init(void)
 {
   /*##-1- Configure the UART peripheral ######################################*/
@@ -311,7 +385,10 @@
     else
     if(huart == &UartIR_HUD_Handle)
     {
+#ifndef BOOTLOADER_STANDALONE
     	tCCR_SetRXIndication();
+#endif
+		UartReadyHUD = SET;
     }
 }