Mercurial > public > ostc4
comparison 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 | 75f958ca5d0e |
comparison
equal
deleted
inserted
replaced
| 884:940f8e132638 | 885:8d3f3a635397 |
|---|---|
| 66 | 66 |
| 67 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_RESET); | 67 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_RESET); |
| 68 HAL_Delay(10); | 68 HAL_Delay(10); |
| 69 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_SET); | 69 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_SET); |
| 70 HAL_Delay(25); | 70 HAL_Delay(25); |
| 71 | |
| 71 // check for new screen | 72 // check for new screen |
| 72 hardwareDisplay=0; // default is old screen | |
| 73 aTxBuffer[0] = 0x71; // Read internal register | 73 aTxBuffer[0] = 0x71; // Read internal register |
| 74 if (receive_screen((uint8_t*)aTxBuffer) == 0x27) // chip Index (=0x27 for new screen) | 74 if (receive_screen((uint8_t*)aTxBuffer) == 0x27) // chip Index (=0x27 for new screen) |
| 75 { | 75 { |
| 76 hardwareDisplay=1; | 76 SetDisplayVersion(DISPLAY_VERSION_NEW); |
| 77 } | 77 } |
| 78 else | 78 else |
| 79 { // re-reset the screen to be sure the 0x71 command did nothing | 79 { // re-reset the screen to be sure the 0x71 command did nothing |
| 80 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_RESET); | 80 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_RESET); |
| 81 HAL_Delay(10); | 81 HAL_Delay(10); |
| 82 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_SET); | 82 HAL_GPIO_WritePin(DISPLAY_RESETB_GPIO_PORT,DISPLAY_RESETB_PIN,GPIO_PIN_SET); |
| 83 HAL_Delay(25); | 83 HAL_Delay(25); |
| 84 | 84 |
| 85 SetDisplayVersion(DISPLAY_VERSION_LCD); | |
| 85 } | 86 } |
| 86 | 87 |
| 87 /* RGB signals should be now for 2 frames or more (datasheet) */ | 88 /* RGB signals should be now for 2 frames or more (datasheet) */ |
| 88 } | 89 } |
| 89 | 90 |
| 165 return outputlength; | 166 return outputlength; |
| 166 } | 167 } |
| 167 | 168 |
| 168 void display_power_off(void) | 169 void display_power_off(void) |
| 169 { | 170 { |
| 170 if (hardwareDisplay == 1) | 171 if (isNewDisplay()) |
| 171 { | 172 { |
| 172 uint8_t aTxBuffer[3]; | 173 uint8_t aTxBuffer[3]; |
| 173 | 174 |
| 174 aTxBuffer[0] = 0x70; | 175 aTxBuffer[0] = 0x70; |
| 175 aTxBuffer[1] = OLED_DDISP_ON_14h; | 176 aTxBuffer[1] = OLED_DDISP_ON_14h; |
| 194 } | 195 } |
| 195 | 196 |
| 196 | 197 |
| 197 void display_power_on__2_of_2__post_RGB(void) | 198 void display_power_on__2_of_2__post_RGB(void) |
| 198 { | 199 { |
| 199 if (hardwareDisplay == 1) | 200 if (isNewDisplay()) |
| 200 { | 201 { |
| 201 display_power_on__2_of_2__post_RGB_display1(); | 202 display_power_on__2_of_2__post_RGB_display1(); |
| 202 } | 203 } |
| 203 else | 204 else |
| 204 { | 205 { |
