Mercurial > public > ostc4
comparison Discovery/Src/gfx_engine.c @ 1053:36fa1c44e597 Icon_Integration
Added upload command for icon:
It is now possible to upload a custom icon which is shown during startup and while writing settings (instead of the HW string). The icons are limited to 256 colors and 800x480 pixels. The icon may not be larger than 200kByte because of storage avability. For upload the same CRC functions as for the common firmware updates are in use,
| author | Ideenmodellierer |
|---|---|
| date | Wed, 31 Dec 2025 17:49:05 +0100 |
| parents | 65d35e66efb9 |
| children |
comparison
equal
deleted
inserted
replaced
| 1052:3029dd4398a5 | 1053:36fa1c44e597 |
|---|---|
| 289 void GFX_build_logo_frame(void) | 289 void GFX_build_logo_frame(void) |
| 290 { | 290 { |
| 291 GFX_DrawCfgScreen tLogoTemp; | 291 GFX_DrawCfgScreen tLogoTemp; |
| 292 SWindowGimpStyle windowGimp; | 292 SWindowGimpStyle windowGimp; |
| 293 | 293 |
| 294 SIconHeader* pIconHeader = (SIconHeader*) ICON_HEADER_ADDR; | |
| 295 tImage Image; | |
| 296 Image.data= (uint8_t*) (ICON_HEADER_ADDR + 12 + (256 * 4)); /* Offset Header + CLUT */ | |
| 297 | |
| 298 Image.width = ((pIconHeader->dummy7 & 0x0F) << 8) | pIconHeader->dummy5; | |
| 299 Image.height = ((pIconHeader->dummy7 & 0xF0) << 4) | pIconHeader->dummy6; | |
| 300 | |
| 301 | |
| 294 pLogoFrame = getFrame(1); | 302 pLogoFrame = getFrame(1); |
| 295 logoStatus = LOGOOFF; | 303 logoStatus = LOGOOFF; |
| 296 | 304 |
| 297 tLogoTemp.FBStartAdress = pLogoFrame; | 305 tLogoTemp.FBStartAdress = pLogoFrame; |
| 298 tLogoTemp.ImageHeight = 480; | 306 tLogoTemp.ImageHeight = 480; |
| 299 tLogoTemp.ImageWidth = 800; | 307 tLogoTemp.ImageWidth = 800; |
| 300 tLogoTemp.LayerIndex = 1; | 308 tLogoTemp.LayerIndex = 1; |
| 301 | 309 |
| 302 windowGimp.left = (800 - 400) / 2; | 310 if(pIconHeader->type == 0x20) |
| 303 windowGimp.top = (480 - 46) / 2; | 311 { |
| 304 | 312 windowGimp.left = (800 - Image.width) / 2; |
| 305 GFX_draw_image_color(&tLogoTemp, windowGimp, &ImgHWcolor); | 313 windowGimp.top = (480 - Image.height) / 2; |
| 314 | |
| 315 GFX_draw_image_color(&tLogoTemp, windowGimp, &Image); | |
| 316 } | |
| 317 else | |
| 318 { | |
| 319 windowGimp.left = (800 - ImgHWcolor.width) / 2; | |
| 320 windowGimp.top = (480 - ImgHWcolor.height) / 2; | |
| 321 GFX_draw_image_color(&tLogoTemp, windowGimp, &ImgHWcolor); | |
| 322 } | |
| 323 | |
| 324 | |
| 306 /* | 325 /* |
| 307 char localtext[256]; | 326 char localtext[256]; |
| 308 uint8_t ptr = 0; | 327 uint8_t ptr = 0; |
| 309 | 328 |
| 310 localtext[ptr++] = ' '; | 329 localtext[ptr++] = ' '; |
| 495 uint32_t bottomStartBot = 0; | 514 uint32_t bottomStartBot = 0; |
| 496 uint8_t change_position = 0; | 515 uint8_t change_position = 0; |
| 497 uint8_t change_size = 0; | 516 uint8_t change_size = 0; |
| 498 uint8_t nextBottomBackup = FrameHandler.NextBottomRead; /* Restore entry value in case off logo handling */ | 517 uint8_t nextBottomBackup = FrameHandler.NextBottomRead; /* Restore entry value in case off logo handling */ |
| 499 | 518 |
| 519 SIconHeader* pIconHeader = (SIconHeader*) ICON_HEADER_ADDR; | |
| 520 uint32_t* pCLUT; | |
| 521 pCLUT = (uint32_t *)indexHWcolor; | |
| 522 | |
| 523 | |
| 500 // Top Frame | 524 // Top Frame |
| 501 if(FrameHandler.NextTopRead != FrameHandler.NextTopWrite) | 525 if(FrameHandler.NextTopRead != FrameHandler.NextTopWrite) |
| 502 { | 526 { |
| 503 FrameHandler.NextTopRead++; | 527 FrameHandler.NextTopRead++; |
| 504 if(FrameHandler.NextTopRead == RING_BUF_SIZE) | 528 if(FrameHandler.NextTopRead == RING_BUF_SIZE) |
| 526 if(logoStatus != LOGOOFF) | 550 if(logoStatus != LOGOOFF) |
| 527 { | 551 { |
| 528 switch(logoStatus) | 552 switch(logoStatus) |
| 529 { | 553 { |
| 530 case LOGOSTART: | 554 case LOGOSTART: |
| 555 if(pIconHeader->type == 0x20) | |
| 556 { | |
| 557 pCLUT = (uint32_t *)(pIconHeader + 1); /* First address behind the header */ | |
| 558 } | |
| 531 HAL_LTDC_SetAlpha(&LtdcHandle, 0, 1); | 559 HAL_LTDC_SetAlpha(&LtdcHandle, 0, 1); |
| 532 HAL_LTDC_SetAlpha(&LtdcHandle, 34, 0); | 560 HAL_LTDC_SetAlpha(&LtdcHandle, 34, 0); |
| 533 HAL_LTDC_ConfigCLUT(&LtdcHandle, (uint32_t *)indexHWcolor, indexHWcolorSIZE, 0); | 561 HAL_LTDC_ConfigCLUT(&LtdcHandle, pCLUT, indexHWcolorSIZE, 0); |
| 534 HAL_LTDC_SetAddress(&LtdcHandle, pLogoFrame, 0); | 562 HAL_LTDC_SetAddress(&LtdcHandle, pLogoFrame, 0); |
| 535 HAL_LTDC_SetWindowSize(&LtdcHandle, 480, 800, 0); | 563 HAL_LTDC_SetWindowSize(&LtdcHandle, 480, 800, 0); |
| 536 HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, 0, 0); | 564 HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, 0, 0); |
| 537 logoStatus = 2; | 565 logoStatus = 2; |
| 538 FrameHandler.NextBottomRead = nextBottomBackup; | 566 FrameHandler.NextBottomRead = nextBottomBackup; |
| 585 { | 613 { |
| 586 | 614 |
| 587 switch(backgroundHwStatus) | 615 switch(backgroundHwStatus) |
| 588 { | 616 { |
| 589 case LOGOSTART: | 617 case LOGOSTART: |
| 590 HAL_LTDC_ConfigCLUT(&LtdcHandle, (uint32_t *)indexHWcolor, indexHWcolorSIZE, 0); | 618 HAL_LTDC_ConfigCLUT(&LtdcHandle, pCLUT, indexHWcolorSIZE, 0); |
| 591 HAL_LTDC_SetAddress(&LtdcHandle, pBackgroundHwFrame, 0); | 619 HAL_LTDC_SetAddress(&LtdcHandle, pBackgroundHwFrame, 0); |
| 592 HAL_LTDC_SetWindowSize(&LtdcHandle, 480, 800, 0); | 620 HAL_LTDC_SetWindowSize(&LtdcHandle, 480, 800, 0); |
| 593 HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, 0, 0); | 621 HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, 0, 0); |
| 594 backgroundHwStatus = 2; | 622 backgroundHwStatus = 2; |
| 595 FrameHandler.NextBottomRead = nextBottomBackup; | 623 FrameHandler.NextBottomRead = nextBottomBackup; |
