diff Discovery/Src/display.c @ 885:8d3f3a635397 Evo_2_23

Replaced global hardwareDisplay with unit access: The previous global hardwaredisplay, which indicated the display version, is stored in scope of ostc.c with interface function access.
author Ideenmodellierer
date Sun, 01 Sep 2024 21:35:50 +0200
parents 6b06143cbfea
children
line wrap: on
line diff
--- a/Discovery/Src/display.c	Sun Sep 01 20:31:01 2024 +0200
+++ b/Discovery/Src/display.c	Sun Sep 01 21:35:50 2024 +0200
@@ -68,13 +68,13 @@
 	HAL_Delay(10);
 	HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_SET);
 	HAL_Delay(25);
+
 	// check for new screen
-	hardwareDisplay=0;		// default is old screen
 	aTxBuffer[0] = 0x71;	// Read internal register
 	if (receive_screen((uint8_t*)aTxBuffer) == 0x27)		// chip Index (=0x27 for new screen)
-		{
-		hardwareDisplay=1;
-		}
+	{
+		SetDisplayVersion(DISPLAY_VERSION_NEW);
+	}
 	else
 	{	// re-reset the screen to be sure the 0x71 command did nothing
 		HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_RESET);
@@ -82,6 +82,7 @@
 		HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_SET);
 		HAL_Delay(25);
 
+		SetDisplayVersion(DISPLAY_VERSION_LCD);
 	}
 
 	/* RGB signals should be now for 2 frames or more (datasheet) */
@@ -167,7 +168,7 @@
 
 void display_power_off(void)
 {
-	if (hardwareDisplay == 1)
+	if (isNewDisplay())
 		{
 		uint8_t aTxBuffer[3];
 
@@ -196,7 +197,7 @@
 
 void display_power_on__2_of_2__post_RGB(void)
 {
-	if (hardwareDisplay == 1)
+	if (isNewDisplay())
 		{
 		display_power_on__2_of_2__post_RGB_display1();
 		}