Mercurial > public > ostc4
comparison Discovery/Src/gfx_engine.c @ 981:c6c781a2e85b default tip
Merge into default
author | heinrichsweikamp |
---|---|
date | Tue, 11 Feb 2025 18:12:00 +0100 (4 days ago) |
parents | 8d3f3a635397 |
children |
comparison
equal
deleted
inserted
replaced
871:f7318457df4d | 981:c6c781a2e85b |
---|---|
34 | 34 |
35 /* Exported variables --------------------------------------------------------*/ | 35 /* Exported variables --------------------------------------------------------*/ |
36 | 36 |
37 /* Private types -------------------------------------------------------------*/ | 37 /* Private types -------------------------------------------------------------*/ |
38 | 38 |
39 #define RING_BUF_SIZE (5u) | 39 #define RING_BUF_SIZE (5u) |
40 #define MAX_COLOR_STRING_LENGTH (100u) | |
40 | 41 |
41 typedef struct | 42 typedef struct |
42 { | 43 { |
43 uint32_t Xdelta; | 44 uint32_t Xdelta; |
44 uint32_t Ydelta; | 45 uint32_t Ydelta; |
249 void GFX_hwBackgroundOff(void) | 250 void GFX_hwBackgroundOff(void) |
250 { | 251 { |
251 backgroundHwStatus = LOGOSTOP; | 252 backgroundHwStatus = LOGOSTOP; |
252 } | 253 } |
253 | 254 |
254 | |
255 void GFX_build_hw_background_frame(void) | 255 void GFX_build_hw_background_frame(void) |
256 { | 256 { |
257 GFX_DrawCfgScreen tLogoTemp; | 257 GFX_DrawCfgScreen tLogoTemp; |
258 SWindowGimpStyle windowGimp; | 258 SWindowGimpStyle windowGimp; |
259 | 259 |
317 | 317 |
318 write_content_simple(&tLogoTemp, 0, 800, 240-24, &FontT24,localtext,CLUT_Font020); | 318 write_content_simple(&tLogoTemp, 0, 800, 240-24, &FontT24,localtext,CLUT_Font020); |
319 */ | 319 */ |
320 } | 320 } |
321 | 321 |
322 | |
323 void GFX_init(uint32_t * pDestinationOut) | 322 void GFX_init(uint32_t * pDestinationOut) |
324 { | 323 { |
325 frame[0].StartAddress = FBGlobalStart; | 324 frame[0].StartAddress = FBGlobalStart; |
326 GFX_clear_frame_immediately(frame[0].StartAddress); | 325 GFX_clear_frame_immediately(frame[0].StartAddress); |
327 frame[0].status = CLEAR; | 326 frame[0].status = CLEAR; |
339 *pDestinationOut = pInvisibleFrame; | 338 *pDestinationOut = pInvisibleFrame; |
340 | 339 |
341 GFX_build_logo_frame(); | 340 GFX_build_logo_frame(); |
342 GFX_build_hw_background_frame(); | 341 GFX_build_hw_background_frame(); |
343 | 342 |
343 /* Register to memory mode with ARGB8888 as color Mode */ | |
344 Dma2dHandle.Init.Mode = DMA2D_R2M; | |
345 Dma2dHandle.Init.ColorMode = DMA2D_ARGB4444;//to fake AL88, before: DMA2D_ARGB8888; | |
346 Dma2dHandle.Init.OutputOffset = 0; | |
347 | |
348 /* DMA2D Callbacks Configuration */ | |
349 Dma2dHandle.XferCpltCallback = GFX_Dma2d_TransferComplete; | |
350 Dma2dHandle.XferErrorCallback = GFX_Dma2d_TransferError; | |
351 | |
352 Dma2dHandle.Instance = DMA2D; | |
353 | |
354 /* DMA2D Initialisation */ | |
355 if(HAL_DMA2D_Init(&Dma2dHandle) != HAL_OK) | |
356 GFX_Error_Handler(); | |
357 | |
358 if(HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1) != HAL_OK) | |
359 GFX_Error_Handler(); | |
360 | |
361 DMA2D_at_work = 255; | |
362 } | |
363 void GFX_init1_no_DMA(uint32_t * pDestinationOut, uint8_t blockFrames) | |
364 { | |
365 frame[0].StartAddress = FBGlobalStart; | |
366 GFX_clear_frame_immediately(frame[0].StartAddress); | |
367 frame[0].status = CLEAR; | |
368 frame[0].caller = 0; | |
369 | |
370 for(int i=1;i<MAXFRAMES;i++) | |
371 { | |
372 frame[i].StartAddress = frame[i-1].StartAddress + FBOffsetEachIndex; | |
373 GFX_clear_frame_immediately(frame[i].StartAddress); | |
374 frame[i].status = CLEAR; | |
375 frame[i].caller = 0; | |
376 } | |
377 | |
378 for(int i=0;i<blockFrames;i++) | |
379 { | |
380 frame[i].status = BLOCKED; | |
381 frame[i].caller = 1; | |
382 } | |
383 | |
384 pInvisibleFrame = getFrame(2); | |
385 *pDestinationOut = pInvisibleFrame; | |
386 | |
387 GFX_build_logo_frame(); | |
388 GFX_build_hw_background_frame(); | |
389 } | |
390 | |
391 | |
392 void GFX_init2_DMA(void) | |
393 { | |
344 /* Register to memory mode with ARGB8888 as color Mode */ | 394 /* Register to memory mode with ARGB8888 as color Mode */ |
345 Dma2dHandle.Init.Mode = DMA2D_R2M; | 395 Dma2dHandle.Init.Mode = DMA2D_R2M; |
346 Dma2dHandle.Init.ColorMode = DMA2D_ARGB4444;//to fake AL88, before: DMA2D_ARGB8888; | 396 Dma2dHandle.Init.ColorMode = DMA2D_ARGB4444;//to fake AL88, before: DMA2D_ARGB8888; |
347 Dma2dHandle.Init.OutputOffset = 0; | 397 Dma2dHandle.Init.OutputOffset = 0; |
348 | 398 |
531 } | 581 } |
532 return; | 582 return; |
533 } | 583 } |
534 else if (backgroundHwStatus != LOGOOFF) | 584 else if (backgroundHwStatus != LOGOOFF) |
535 { | 585 { |
586 | |
536 switch(backgroundHwStatus) | 587 switch(backgroundHwStatus) |
537 { | 588 { |
538 case LOGOSTART: | 589 case LOGOSTART: |
539 HAL_LTDC_ConfigCLUT(&LtdcHandle, (uint32_t *)indexHWcolor, indexHWcolorSIZE, 0); | 590 HAL_LTDC_ConfigCLUT(&LtdcHandle, (uint32_t *)indexHWcolor, indexHWcolorSIZE, 0); |
540 HAL_LTDC_SetAddress(&LtdcHandle, pBackgroundHwFrame, 0); | 591 HAL_LTDC_SetAddress(&LtdcHandle, pBackgroundHwFrame, 0); |
565 | 616 |
566 default: | 617 default: |
567 FrameHandler.NextBottomRead = nextBottomBackup; | 618 FrameHandler.NextBottomRead = nextBottomBackup; |
568 break; | 619 break; |
569 } | 620 } |
621 | |
570 return; | 622 return; |
571 } | 623 } |
572 else | 624 else |
573 { | 625 { |
574 pBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].pBuffer; | 626 pBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].pBuffer; |
974 } | 1026 } |
975 } | 1027 } |
976 } | 1028 } |
977 } | 1029 } |
978 | 1030 |
979 | |
980 static void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image) | 1031 static void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image) |
981 { | 1032 { |
982 uint16_t* pDestination; | 1033 uint16_t* pDestination; |
983 | 1034 |
984 uint32_t j; | 1035 uint32_t j; |
2005 minimal = 1; | 2056 minimal = 1; |
2006 else | 2057 else |
2007 minimal = 0; | 2058 minimal = 0; |
2008 | 2059 |
2009 if(Font == &FontT144) | 2060 if(Font == &FontT144) |
2061 { | |
2010 settings.TinyFont = (uint32_t)&FontT84; | 2062 settings.TinyFont = (uint32_t)&FontT84; |
2063 settings.Ydelta = 12; | |
2064 } | |
2011 else | 2065 else |
2012 if(Font == &FontT105) | 2066 if(Font == &FontT105) |
2013 settings.TinyFont = (uint32_t)&FontT54; | 2067 settings.TinyFont = (uint32_t)&FontT54; |
2014 else | 2068 else |
2015 if(Font == &FontT54) | 2069 if(Font == &FontT54) |
2101 { | 2155 { |
2102 settings.dualFont = 0; | 2156 settings.dualFont = 0; |
2103 settings.actualFont = (tFont *)settings.font; | 2157 settings.actualFont = (tFont *)settings.font; |
2104 } | 2158 } |
2105 else | 2159 else |
2160 #ifndef BOOTLOADER_STANDALONE | |
2106 if((*pText == '\005') && !minimal) | 2161 if((*pText == '\005') && !minimal) |
2107 { | 2162 { |
2108 newXdelta = GFX_write_char(hgfx, &settings, 'a', (tFont *)&Awe48); | 2163 newXdelta = GFX_write_char(hgfx, &settings, 'a', (tFont *)&Awe48); |
2109 settings.Xdelta = newXdelta; | 2164 settings.Xdelta = newXdelta; |
2110 } | 2165 } |
2113 { | 2168 { |
2114 newXdelta = GFX_write_char(hgfx, &settings, 'b', (tFont *)&Awe48); | 2169 newXdelta = GFX_write_char(hgfx, &settings, 'b', (tFont *)&Awe48); |
2115 settings.Xdelta = newXdelta; | 2170 settings.Xdelta = newXdelta; |
2116 } | 2171 } |
2117 else | 2172 else |
2173 #endif | |
2118 if((*pText >= '\020') && (*pText <= '\032') && !minimal) | 2174 if((*pText >= '\020') && (*pText <= '\032') && !minimal) |
2119 settings.color = *pText - '\020'; | 2175 settings.color = *pText - '\020'; |
2120 else | 2176 else |
2121 if((*pText == '\034') && !minimal) | 2177 if((*pText == '\034') && !minimal) |
2122 settings.spaceMode = 1; | 2178 settings.spaceMode = 1; |
2189 { | 2245 { |
2190 uint8_t i, j; | 2246 uint8_t i, j; |
2191 uint32_t found; | 2247 uint32_t found; |
2192 uint32_t pText; | 2248 uint32_t pText; |
2193 uint16_t decodeUTF8; | 2249 uint16_t decodeUTF8; |
2194 uint8_t gfx_selected_language; | |
2195 #ifndef BOOTLOADER_STANDALONE | 2250 #ifndef BOOTLOADER_STANDALONE |
2251 uint8_t gfx_selected_language = 0; | |
2196 SSettings *pSettings; | 2252 SSettings *pSettings; |
2197 pSettings = settingsGetPointer(); | 2253 pSettings = settingsGetPointer(); |
2198 gfx_selected_language = pSettings->selected_language; | 2254 gfx_selected_language = pSettings->selected_language; |
2199 if(gfx_selected_language >= LANGUAGE_END) | 2255 if(gfx_selected_language >= LANGUAGE_END) gfx_selected_language = 0; |
2200 #endif | 2256 #endif |
2201 gfx_selected_language = 0; | |
2202 | |
2203 | 2257 |
2204 // ----------------------------- | 2258 // ----------------------------- |
2205 if(textId != (uint8_t)TXT_2BYTE) | 2259 if(textId != (uint8_t)TXT_2BYTE) |
2206 { | 2260 { |
2207 found = 0; | 2261 found = 0; |
2208 j = 0; | 2262 j = 0; |
2209 for(i=(uint8_t)TXT_Language;i<(uint8_t)TXT_END;i++) | 2263 for(i=(uint8_t)TXT_Language;i<(uint8_t)TXT_END;i++) |
2210 { | 2264 { |
2265 #ifndef BOOTLOADER_STANDALONE | |
2211 if(text_array[j].code == textId) | 2266 if(text_array[j].code == textId) |
2212 { | 2267 { |
2213 found = 1; | 2268 found = 1; |
2214 break; | 2269 break; |
2215 } | 2270 } |
2271 #endif | |
2216 j++; | 2272 j++; |
2217 } | 2273 } |
2218 if(!found) | 2274 if(!found) |
2219 return cfg->Xdelta; | 2275 return cfg->Xdelta; |
2220 | 2276 |
2221 // ----------------------------- | 2277 // ----------------------------- |
2278 #ifndef BOOTLOADER_STANDALONE | |
2222 pText = (uint32_t)text_array[j].text[gfx_selected_language]; | 2279 pText = (uint32_t)text_array[j].text[gfx_selected_language]; |
2223 if(!pText) | 2280 if(!pText) |
2224 pText = (uint32_t)text_array[j].text[0]; | 2281 pText = (uint32_t)text_array[j].text[0]; |
2225 else | 2282 else |
2226 if(*(char*)pText == 0) | 2283 if(*(char*)pText == 0) |
2227 pText = (uint32_t)text_array[j].text[0]; | 2284 pText = (uint32_t)text_array[j].text[0]; |
2285 #endif | |
2228 } | 2286 } |
2229 // ----------------------------- | 2287 // ----------------------------- |
2230 else | 2288 else |
2231 { | 2289 { |
2232 if(!nextCharFor2Byte) | 2290 if(!nextCharFor2Byte) |
2233 return cfg->Xdelta; | 2291 return cfg->Xdelta; |
2234 | 2292 |
2235 found = 0; | 2293 found = 0; |
2236 for(j=0;j<(uint8_t)TXT2BYTE_END-(uint8_t)TXT2BYTE_START;j++) | 2294 for(j=0;j<(uint8_t)TXT2BYTE_END-(uint8_t)TXT2BYTE_START;j++) |
2237 { | 2295 { |
2296 #ifndef BOOTLOADER_STANDALONE | |
2238 if((uint8_t)text_array2[j].code == (uint8_t)nextCharFor2Byte) | 2297 if((uint8_t)text_array2[j].code == (uint8_t)nextCharFor2Byte) |
2239 { | 2298 { |
2240 found = 1; | 2299 found = 1; |
2241 break; | 2300 break; |
2242 } | 2301 } |
2302 #endif | |
2243 } | 2303 } |
2244 if(!found) | 2304 if(!found) |
2245 return cfg->Xdelta; | 2305 return cfg->Xdelta; |
2306 #ifndef BOOTLOADER_STANDALONE | |
2246 // ----------------------------- | 2307 // ----------------------------- |
2247 pText = (uint32_t)text_array2[j].text[gfx_selected_language]; | 2308 pText = (uint32_t)text_array2[j].text[gfx_selected_language]; |
2248 if(!pText) | 2309 if(!pText) |
2249 pText = (uint32_t)text_array2[j].text[0]; | 2310 pText = (uint32_t)text_array2[j].text[0]; |
2250 else | 2311 else |
2251 if(*(char*)pText == 0) | 2312 if(*(char*)pText == 0) |
2252 pText = (uint32_t)text_array2[j].text[0]; | 2313 pText = (uint32_t)text_array2[j].text[0]; |
2314 #endif | |
2253 } | 2315 } |
2254 // ----------------------------- | 2316 // ----------------------------- |
2255 | 2317 |
2256 if(cfg->actualFont == (tFont *)cfg->TinyFont) | 2318 if(cfg->actualFont == (tFont *)cfg->TinyFont) |
2257 cfg->Ydelta += cfg->TinyFontExtraYdelta; | 2319 cfg->Ydelta += cfg->TinyFontExtraYdelta; |
2686 * @retval Ydelta: 0x0000FFFF if not successful or char_truncated | 2748 * @retval Ydelta: 0x0000FFFF if not successful or char_truncated |
2687 */ | 2749 */ |
2688 | 2750 |
2689 static uint32_t GFX_write_char(GFX_DrawCfgWindow* hgfx, GFX_CfgWriteString* cfg, uint8_t character, tFont *Font) | 2751 static uint32_t GFX_write_char(GFX_DrawCfgWindow* hgfx, GFX_CfgWriteString* cfg, uint8_t character, tFont *Font) |
2690 { | 2752 { |
2753 | |
2754 #ifndef BOOTLOADER_STANDALONE | |
2691 Font = GFX_Check_Extra_Font(character, Font); | 2755 Font = GFX_Check_Extra_Font(character, Font); |
2756 #endif | |
2692 if(cfg->doubleSize) | 2757 if(cfg->doubleSize) |
2693 { | 2758 { |
2694 return GFX_write_char_doubleSize(hgfx, cfg, character, Font); | 2759 return GFX_write_char_doubleSize(hgfx, cfg, character, Font); |
2695 } | 2760 } |
2696 | 2761 |
3007 return 0x0000FFFF; | 3072 return 0x0000FFFF; |
3008 else | 3073 else |
3009 return cfg->Xdelta + width; | 3074 return cfg->Xdelta + width; |
3010 } | 3075 } |
3011 | 3076 |
3077 #ifndef BOOTLOADER_STANDALONE | |
3012 | 3078 |
3013 /** | 3079 /** |
3014 ****************************************************************************** | 3080 ****************************************************************************** |
3015 * @brief GFX write Modify helper for center and right align. | 3081 * @brief GFX write Modify helper for center and right align. |
3016 * @author heinrichs weikamp gmbh | 3082 * @author heinrichs weikamp gmbh |
3106 } | 3172 } |
3107 cText[counter] = 0; | 3173 cText[counter] = 0; |
3108 return counter; | 3174 return counter; |
3109 } | 3175 } |
3110 | 3176 |
3111 | 3177 #endif |
3112 /** | 3178 /** |
3113 ****************************************************************************** | 3179 ****************************************************************************** |
3114 * @brief GFX write Modify Ydelta for align. / calc Ydelta for start | 3180 * @brief GFX write Modify Ydelta for align. / calc Ydelta for start |
3115 * @author heinrichs weikamp gmbh | 3181 * @author heinrichs weikamp gmbh |
3116 * @version V0.0.1 | 3182 * @version V0.0.1 |
3127 { | 3193 { |
3128 char cText[101]; | 3194 char cText[101]; |
3129 uint32_t result; | 3195 uint32_t result; |
3130 uint32_t Xsum; | 3196 uint32_t Xsum; |
3131 uint32_t j; | 3197 uint32_t j; |
3132 uint8_t gfx_selected_language; | |
3133 uint32_t pText; | 3198 uint32_t pText; |
3134 uint16_t decodeUTF8; | 3199 uint16_t decodeUTF8; |
3135 uint8_t tinyState = 0; /* used to identify the usage of tiny font */ | 3200 uint8_t tinyState = 0; /* used to identify the usage of tiny font */ |
3136 tFont* ptargetFont; | 3201 tFont* ptargetFont; |
3137 | 3202 |
3138 #ifndef BOOTLOADER_STANDALONE | 3203 #ifndef BOOTLOADER_STANDALONE |
3204 uint8_t gfx_selected_language = 0; | |
3139 SSettings *pSettings; | 3205 SSettings *pSettings; |
3140 pSettings = settingsGetPointer(); | 3206 pSettings = settingsGetPointer(); |
3141 gfx_selected_language = pSettings->selected_language; | 3207 gfx_selected_language = pSettings->selected_language; |
3142 if(gfx_selected_language >= LANGUAGE_END) | 3208 if(gfx_selected_language >= LANGUAGE_END) gfx_selected_language = 0; |
3143 #endif | 3209 #endif |
3144 gfx_selected_language = 0; | |
3145 // ----------------------------- | 3210 // ----------------------------- |
3146 | 3211 #ifndef BOOTLOADER_STANDALONE |
3147 GFX_write__Modify_helper(cText,pTextInput,gfx_selected_language); | 3212 GFX_write__Modify_helper(cText,pTextInput,gfx_selected_language); |
3148 | 3213 #endif |
3149 pText = (uint32_t)&cText[0]; | 3214 pText = (uint32_t)&cText[0]; |
3150 Xsum = 0; | 3215 Xsum = 0; |
3151 j = 0; | 3216 j = 0; |
3152 ptargetFont = (tFont *)cfg->font; | 3217 ptargetFont = (tFont *)cfg->font; |
3153 while (*(char*)pText != 0)// und fehlend: Abfrage window / image size | 3218 while (*(char*)pText != 0)// und fehlend: Abfrage window / image size |
3220 } | 3285 } |
3221 | 3286 |
3222 | 3287 |
3223 static uint32_t GFX_write__Modify_Xdelta__RightAlign(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput) | 3288 static uint32_t GFX_write__Modify_Xdelta__RightAlign(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput) |
3224 { | 3289 { |
3225 char cText[101]; | |
3226 uint32_t result; | 3290 uint32_t result; |
3227 uint32_t Xsum; | 3291 uint32_t Xsum; |
3228 uint32_t j; | 3292 uint32_t j; |
3229 tFont *font; | 3293 tFont *font; |
3230 uint8_t gfx_selected_language; | 3294 char cText[101]; |
3231 uint32_t pText; | 3295 uint32_t pText; |
3232 uint16_t decodeUTF8; | 3296 uint16_t decodeUTF8; |
3233 uint8_t tinyState = 0; /* used to identify the usage of tiny font */ | 3297 uint8_t tinyState = 0; /* used to identify the usage of tiny font */ |
3234 | 3298 |
3235 #ifndef BOOTLOADER_STANDALONE | 3299 #ifndef BOOTLOADER_STANDALONE |
3300 uint8_t gfx_selected_language = 0; | |
3236 SSettings *pSettings; | 3301 SSettings *pSettings; |
3237 pSettings = settingsGetPointer(); | 3302 pSettings = settingsGetPointer(); |
3238 gfx_selected_language = pSettings->selected_language; | 3303 gfx_selected_language = pSettings->selected_language; |
3239 if(gfx_selected_language >= LANGUAGE_END) | 3304 if(gfx_selected_language >= LANGUAGE_END) gfx_selected_language = 0; |
3305 #else | |
3306 cText[0] = 0; | |
3240 #endif | 3307 #endif |
3241 gfx_selected_language = 0; | |
3242 // ----------------------------- | 3308 // ----------------------------- |
3243 | 3309 #ifndef BOOTLOADER_STANDALONE |
3244 GFX_write__Modify_helper(cText,pTextInput,gfx_selected_language); | 3310 GFX_write__Modify_helper(cText,pTextInput,gfx_selected_language); |
3311 #endif | |
3245 pText = (uint32_t)&cText[0]; | 3312 pText = (uint32_t)&cText[0]; |
3246 | |
3247 // ----------------------------- | 3313 // ----------------------------- |
3248 | 3314 |
3249 font = (tFont *)cfg->font; | 3315 font = (tFont *)cfg->font; |
3250 Xsum = 0; | 3316 Xsum = 0; |
3251 j = 0; | 3317 j = 0; |
3324 return result; | 3390 return result; |
3325 } | 3391 } |
3326 | 3392 |
3327 void GFX_LTDC_Init(void) | 3393 void GFX_LTDC_Init(void) |
3328 { | 3394 { |
3329 if (hardwareDisplay == 1) | 3395 if (isNewDisplay()) |
3330 { | 3396 { |
3331 GFX_LTDC_Init_display1(); | 3397 GFX_LTDC_Init_display1(); |
3332 } | 3398 } |
3333 else | 3399 else |
3334 { | 3400 { |
3335 GFX_LTDC_Init_display0(); | 3401 GFX_LTDC_Init_display0(); |
3336 } | 3402 } |
3337 } | 3403 } |
3338 | 3404 |
3339 void GFX_LTDC_Init_display0(void) | 3405 void GFX_LTDC_Init_display0(void) |
3340 { | 3406 { |
3341 /* Timing configuration */ | 3407 /* Timing configuration */ |
3342 | 3408 |
3343 #define ActiveH 800 | 3409 #define ActiveH_d0 800 |
3344 #define ActiveW 480 | 3410 #define ActiveW_d0 480 |
3345 | 3411 |
3346 #define Hsync 10 | 3412 #define Hsync_d0 10 |
3347 #define HFP 8 | 3413 #define HFP_d0 8 |
3348 #define HBP 10 | 3414 #define HBP_d0 10 |
3349 | 3415 |
3350 #define Vsync 2 | 3416 #define Vsync_d0 2 |
3351 #define VFP 2 | 3417 #define VFP_d0 2 |
3352 #define VBP 2 | 3418 #define VBP_d0 2 |
3353 | 3419 |
3354 | 3420 |
3355 /* Horizontal synchronization width = Hsync - 1 */ | 3421 /* Horizontal synchronization width = Hsync - 1 */ |
3356 LtdcHandle.Init.HorizontalSync = Hsync - 1; | 3422 LtdcHandle.Init.HorizontalSync = Hsync_d0 - 1; |
3357 /* Vertical synchronization height = Vsync - 1 */ | 3423 /* Vertical synchronization height = Vsync - 1 */ |
3358 LtdcHandle.Init.VerticalSync = Vsync -1; | 3424 LtdcHandle.Init.VerticalSync = Vsync_d0 - 1; |
3359 /* Accumulated horizontal back porch = Hsync + HBP - 1 */ | 3425 /* Accumulated horizontal back porch = Hsync + HBP - 1 */ |
3360 LtdcHandle.Init.AccumulatedHBP = Hsync + HBP - 1; | 3426 LtdcHandle.Init.AccumulatedHBP = Hsync_d0 + HBP_d0 - 1; |
3361 /* Accumulated vertical back porch = Vsync + VBP - 1 */ | 3427 /* Accumulated vertical back porch = Vsync + VBP - 1 */ |
3362 LtdcHandle.Init.AccumulatedVBP = Vsync + VBP - 1; | 3428 LtdcHandle.Init.AccumulatedVBP = Vsync_d0 + VBP_d0 - 1; |
3363 /* Accumulated active width = Hsync + HBP + Active Width - 1 */ | 3429 /* Accumulated active width = Hsync + HBP + Active Width - 1 */ |
3364 LtdcHandle.Init.AccumulatedActiveW = Hsync + HBP + ActiveW- 1; | 3430 LtdcHandle.Init.AccumulatedActiveW = Hsync_d0 + HBP_d0 + ActiveW_d0 - 1; |
3365 /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */ | 3431 /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */ |
3366 LtdcHandle.Init.AccumulatedActiveH = Vsync + VBP + ActiveH - 1; | 3432 LtdcHandle.Init.AccumulatedActiveH = Vsync_d0 + VBP_d0 + ActiveH_d0 - 1; |
3367 /* Total width = Hsync + HBP + Active Width + HFP - 1 */ | 3433 /* Total width = Hsync + HBP + Active Width + HFP - 1 */ |
3368 LtdcHandle.Init.TotalWidth = Hsync + HBP + ActiveW + HFP - 1; | 3434 LtdcHandle.Init.TotalWidth = Hsync_d0 + HBP_d0 + ActiveW_d0 + HFP_d0 - 1; |
3369 /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */ | 3435 /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */ |
3370 LtdcHandle.Init.TotalHeigh = Vsync + VBP + ActiveH + VFP - 1; | 3436 LtdcHandle.Init.TotalHeigh = Vsync_d0 + VBP_d0 + ActiveH_d0 + VFP_d0 - 1; |
3371 | 3437 |
3372 /* Configure R,G,B component values for LCD background color */ | 3438 /* Configure R,G,B component values for LCD background color */ |
3373 LtdcHandle.Init.Backcolor.Red= 0; | 3439 LtdcHandle.Init.Backcolor.Red= 0; |
3374 LtdcHandle.Init.Backcolor.Blue= 0; | 3440 LtdcHandle.Init.Backcolor.Blue= 0; |
3375 LtdcHandle.Init.Backcolor.Green= 0; | 3441 LtdcHandle.Init.Backcolor.Green= 0; |
3999 } | 4065 } |
4000 } | 4066 } |
4001 */ | 4067 */ |
4002 } | 4068 } |
4003 | 4069 |
4070 #ifndef BOOTLOADER_STANDALONE | |
4004 tFont* GFX_Check_Extra_Font(uint8_t character, tFont *Font) | 4071 tFont* GFX_Check_Extra_Font(uint8_t character, tFont *Font) |
4005 { | 4072 { |
4006 uint32_t i; | 4073 uint32_t i; |
4007 uint32_t found; | 4074 uint32_t found; |
4008 | 4075 |
4028 Font = (tFont *)&FontT105Extra; | 4095 Font = (tFont *)&FontT105Extra; |
4029 } | 4096 } |
4030 | 4097 |
4031 return Font; | 4098 return Font; |
4032 } | 4099 } |
4033 | 4100 #endif |
4034 uint32_t GFX_Character_Width(uint8_t character, tFont *Font) | 4101 uint32_t GFX_Character_Width(uint8_t character, tFont *Font) |
4035 { | 4102 { |
4036 uint32_t i; | 4103 uint32_t i; |
4104 #ifndef BOOTLOADER_STANDALONE | |
4037 uint32_t found; | 4105 uint32_t found; |
4106 #endif | |
4038 | 4107 |
4039 for(i=0;i<Font->length;i++) | 4108 for(i=0;i<Font->length;i++) |
4040 { | 4109 { |
4041 if(Font->chars[i].code == character) | 4110 if(Font->chars[i].code == character) |
4042 { | 4111 { |
4043 return Font->chars[i].image->width; | 4112 return Font->chars[i].image->width; |
4044 } | 4113 } |
4045 } | 4114 } |
4046 | 4115 |
4116 #ifndef BOOTLOADER_STANDALONE | |
4047 found = 0; | 4117 found = 0; |
4048 if (Font == &FontT54) | 4118 if (Font == &FontT54) |
4049 { | 4119 { |
4050 found = 1; | 4120 found = 1; |
4051 Font = (tFont *)&FontT54Extra; | 4121 Font = (tFont *)&FontT54Extra; |
4069 { | 4139 { |
4070 return Font->chars[i].image->width; | 4140 return Font->chars[i].image->width; |
4071 } | 4141 } |
4072 } | 4142 } |
4073 } | 4143 } |
4074 | 4144 #endif |
4075 return 0; | 4145 return 0; |
4076 } | 4146 } |
4147 | |
4148 void Gfx_colorsscheme_mod(char *text, uint8_t alternativeColor) | |
4149 { | |
4150 char *p = text; | |
4151 uint8_t index = 0; | |
4152 | |
4153 while ((*p) && (index < MAX_COLOR_STRING_LENGTH)) | |
4154 { | |
4155 if (*p == '\020') | |
4156 { | |
4157 if(!GFX_is_colorschemeDiveStandard()) | |
4158 { | |
4159 *p = '\027'; | |
4160 } | |
4161 else if(alternativeColor != 0) | |
4162 { | |
4163 *p += alternativeColor; | |
4164 } | |
4165 } | |
4166 p++; | |
4167 index++; | |
4168 } | |
4169 } | |
4170 |