# HG changeset patch # User Jan Mulder # Date 1557989775 -7200 # Node ID 87d54b4fd946a5c53c56a15acc315ed8b236e754 # Parent 87f83879cecb4647d2c10d53eef94aaec96c3942 cleanup: remove unused code, make static, remove commented code Cleanup only. No functional changes. Signed-off-by: Jan Mulder diff -r 87f83879cecb -r 87d54b4fd946 Discovery/Inc/gfx_engine.h --- a/Discovery/Inc/gfx_engine.h Thu May 16 08:54:33 2019 +0200 +++ b/Discovery/Inc/gfx_engine.h Thu May 16 08:56:15 2019 +0200 @@ -123,12 +123,6 @@ void GFX_SetFrameBottom(uint32_t pDestination, uint32_t x0, uint32_t y0, uint32_t width, uint32_t height); void GFX_SetFramesTopBottom(uint32_t pTop, uint32_t pBottom, uint32_t heightBottom); -uint32_t GFX_get_pActualFrameTop(void); -uint32_t GFX_get_pActualFrameBottom(void); - -//void GFX_SetFrameBuffer(uint32_t pDestination, uint32_t LayerIdx); -//void GFX_SetFrameBufferAndResize(uint32_t pDestination, uint32_t LayerIdx, uint32_t height); - void GFX_SetWindowLayer0(uint32_t pDestination, int16_t XleftGimpStyle, int16_t XrightGimpStyle, int16_t YtopGimpStyle, int16_t YbottomGimpStyle); void change_CLUT_entry(uint8_t entryToChange, uint8_t entryUsedForChange); @@ -142,7 +136,6 @@ void GFX_fill_buffer(uint32_t pDestination, uint8_t alpha, uint8_t color); -void GFX_clear_frame_immediately(uint32_t pDestination); void GFX_clear_window_immediately(GFX_DrawCfgWindow* hgfx); //void GFX_draw_circle_with_MEMORY(uint8_t use_memory, GFX_DrawCfgScreen *hgfx, point_t center, uint8_t radius, int8_t color); @@ -189,7 +182,6 @@ void gfx_write_page_number(GFX_DrawCfgScreen *tMscreen, uint8_t page, uint8_t total, uint8_t color); void GFX_draw_image_monochrome(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image, uint8_t color); -void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image); void GFX_logoAutoOff(void); uint8_t GFX_logoStatus(void); void GFX_hwBackgroundOn(void); @@ -197,9 +189,6 @@ uint8_t gfx_number_to_string(uint8_t max_digits, _Bool fill, char *pText, uint32_t number); -void GFX_init1_no_DMA(uint32_t * pDestinationOut, uint8_t blockFrames); -void GFX_init2_DMA(void); - uint8_t GFX_is_colorschemeDiveStandard(void); void GFX_use_colorscheme(uint8_t colorscheme); diff -r 87f83879cecb -r 87d54b4fd946 Discovery/Src/gfx_engine.c --- a/Discovery/Src/gfx_engine.c Thu May 16 08:54:33 2019 +0200 +++ b/Discovery/Src/gfx_engine.c Thu May 16 08:56:15 2019 +0200 @@ -114,27 +114,29 @@ /* Semi Private variables ---------------------------------------------------------*/ DMA2D_HandleTypeDef Dma2dHandle; -LTDC_HandleTypeDef LtdcHandle; +static LTDC_HandleTypeDef LtdcHandle; /* Private variables ---------------------------------------------------------*/ -uint8_t DMA2D_at_work = 0; - -GFX_layerControl FrameHandler = { 0 }; - -uint32_t pInvisibleFrame = 0; -uint32_t pLogoFrame = 0; -uint8_t logoStatus; -uint32_t pBackgroundHwFrame = 0; -uint8_t backgroundHwStatus; - -SFrameList frame[MAXFRAMES]; +static uint8_t DMA2D_at_work = 0; + +static GFX_layerControl FrameHandler = { 0 }; + +static uint32_t pInvisibleFrame = 0; +static uint32_t pLogoFrame = 0; +static uint8_t logoStatus; +static uint32_t pBackgroundHwFrame = 0; +static uint8_t backgroundHwStatus; + +static SFrameList frame[MAXFRAMES]; #define MAXFRAMECOUNTER (28) -uint8_t frameCounter[MAXFRAMECOUNTER] = { 0 }; - -_Bool lock_changeLTDC = 0; - +static uint8_t frameCounter[MAXFRAMECOUNTER] = { 0 }; + +static _Bool lock_changeLTDC = 0; + +static void GFX_clear_frame_immediately(uint32_t pDestination); +static void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image); /* ITM Trace-----------------------------------------------------------------*/ #include "stdio.h" @@ -173,15 +175,15 @@ static uint32_t GFX_write_char(GFX_DrawCfgWindow* hgfx, GFX_CfgWriteString* cfg, uint8_t character, tFont *Font); static uint32_t GFX_write_substring(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, uint8_t textId, int8_t nextCharFor2Byte); -uint32_t GFX_write__Modify_Xdelta__Centered(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pText); -uint32_t GFX_write__Modify_Xdelta__RightAlign(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput); +static uint32_t GFX_write__Modify_Xdelta__Centered(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pText); +static uint32_t GFX_write__Modify_Xdelta__RightAlign(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput); static void GFX_Error_Handler(void); static void GFX_Dma2d_TransferComplete(DMA2D_HandleTypeDef* Dma2dHandle); static void GFX_Dma2d_TransferError(DMA2D_HandleTypeDef* Dma2dHandle); -void GFX_clear_frame_dma2d(uint8_t frameId); - -uint32_t GFX_doubleBufferOne(void); -uint32_t GFX_doubleBufferTwo(void); +static void GFX_clear_frame_dma2d(uint8_t frameId); + +static uint32_t GFX_doubleBufferOne(void); +static uint32_t GFX_doubleBufferTwo(void); /* Exported functions --------------------------------------------------------*/ @@ -191,29 +193,6 @@ return logoStatus; } - -void GFX_helper_font_memory_list(const tFont *Font) -{ - int i; - uint8_t character; - - // ----------------------------- - - for(character = 0x20; character < 0xFF; character++) - { - for(i=0;ilength;i++) - { - if(Font->chars[i].code == character) - { - printf("%02x: 0x%0lx 0x%0lx\n\r",(uint8_t)character, (uint32_t)(Font->chars[i].image->data),((uint32_t)(Font->chars[i+1].image->data)-(uint32_t)(Font->chars[i].image->data))); - break; - } - } - } -} - - - void GFX_SetWindowLayer0(uint32_t pDestination, int16_t XleftGimpStyle, int16_t XrightGimpStyle, int16_t YtopGimpStyle, int16_t YbottomGimpStyle) { int16_t XSize, YSize, X0, Y0; @@ -258,51 +237,6 @@ logoStatus = LOGOSTART; } -/* -uint8_t GFX_printf_firmware(char *text) -{ - uint8_t zahl, ptr; - - ptr = 0; - zahl = settingsGetPointer()->firmwareVersion16to32bit.ub.first; - if(zahl >= 10) - { - text[ptr++] = '0' + (zahl / 10); - zahl = zahl - ((zahl / 10 ) * 10); - } - text[ptr++] = '0' + zahl; - text[ptr++] = '.'; - - zahl = settingsGetPointer()->firmwareVersion16to32bit.ub.second; - if(zahl >= 10) - { - text[ptr++] = '0' + (zahl / 10); - zahl = zahl - ((zahl / 10 ) * 10); - } - text[ptr++] = '0' + zahl; - text[ptr++] = '.'; - - zahl = settingsGetPointer()->firmwareVersion16to32bit.ub.third; - if(zahl >= 10) - { - text[ptr++] = '0' + (zahl / 10); - zahl = zahl - ((zahl / 10 ) * 10); - } - text[ptr++] = '0' + zahl; - - if(settingsGetPointer()->firmwareVersion16to32bit.ub.betaFlag) - { - text[ptr++] = ' '; - text[ptr++] = 'b'; - text[ptr++] = 'e'; - text[ptr++] = 't'; - text[ptr++] = 'a'; - } - text[ptr] = 0; - - return ptr; -} -*/ void GFX_hwBackgroundOn(void) { @@ -316,7 +250,7 @@ } -void GFX_build_hw_background_frame(void) +static void GFX_build_hw_background_frame(void) { GFX_DrawCfgScreen tLogoTemp; SWindowGimpStyle windowGimp; @@ -350,9 +284,7 @@ } - - -void GFX_build_logo_frame(void) +static void GFX_build_logo_frame(void) { GFX_DrawCfgScreen tLogoTemp; SWindowGimpStyle windowGimp; @@ -434,60 +366,6 @@ } -void GFX_init1_no_DMA(uint32_t * pDestinationOut, uint8_t blockFrames) -{ - frame[0].StartAddress = FBGlobalStart; - GFX_clear_frame_immediately(frame[0].StartAddress); - frame[0].status = CLEAR; - frame[0].caller = 0; - - for(int i=1;iDCCR &= ~(LTDC_LxDCCR_DCBLUE | LTDC_LxDCCR_DCGREEN | LTDC_LxDCCR_DCRED | LTDC_LxDCCR_DCALPHA); - __HAL_LTDC_LAYER(&LtdcHandle, LayerIdx)->DCCR = (blue | tmp | tmp1 | 0xFF); - - /* Sets the Reload type */ - LtdcHandle.Instance->SRCR = LTDC_SRCR_IMR; - - /* Initialize the LTDC state*/ - LtdcHandle.State = HAL_LTDC_STATE_READY; - - /* Process unlocked */ - __HAL_UNLOCK(&LtdcHandle); - -return HAL_OK; -} - - -void GFX_clear_frame_immediately(uint32_t pDestination) + +static void GFX_clear_frame_immediately(uint32_t pDestination) { uint32_t i; uint32_t* pfill = (uint32_t*) pDestination; @@ -853,7 +694,7 @@ } -void GFX_clear_frame_dma2d(uint8_t frameId) +static void GFX_clear_frame_dma2d(uint8_t frameId) { if(frameId >= MAXFRAMES) return; @@ -889,7 +730,7 @@ } -void gfx_flip(point_t *p1, point_t *p2) +static void gfx_flip(point_t *p1, point_t *p2) { point_t temp; @@ -1114,7 +955,7 @@ } -void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image) +static void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image) { uint16_t* pDestination; @@ -1160,49 +1001,8 @@ } -int16_Point_t switchToOctantZeroFrom(uint8_t octant, int16_t x, int16_t y) -{ - int16_Point_t answer; - switch(octant) - { - case 0:// return (x,y); - answer.x = x; - answer.y = y; - break; - case 1:// return (y,x); - answer.x = y; - answer.y = x; - break; - case 2:// return (y, -x); - answer.x = y; - answer.y = -x; - break; - case 3:// return (-x, y); - answer.x = -x; - answer.y = y; - break; - case 4:// return (-x, -y); - answer.x = -x; - answer.y = -y; - break; - case 5:// return (-y, -x); - answer.x = -y; - answer.y = -x; - break; - case 6:// return (-y, x); - answer.x = -y; - answer.y = x; - break; - case 7:// return (x, -y); - answer.x = x; - answer.y = -y; - break; - } - return answer; -} - /* this is NOT fast nor optimized */ -void GFX_draw_pixel(GFX_DrawCfgScreen *hgfx, int16_t x, int16_t y, uint8_t color) +static void GFX_draw_pixel(GFX_DrawCfgScreen *hgfx, int16_t x, int16_t y, uint8_t color) { uint16_t* pDestination; @@ -1223,12 +1023,6 @@ *(__IO uint16_t*)pDestination = 0xFF << 8 | color; } - -/* store the quarter circle for given radius */ -void GFX_draw_circle_with_MEMORY(uint8_t use_memory, GFX_DrawCfgScreen *hgfx, point_t center, uint8_t radius, int8_t color) -{ -} - /* this is NOT fast nor optimized */ void GFX_draw_circle(GFX_DrawCfgScreen *hgfx, point_t center, uint8_t radius, int8_t color) { @@ -1394,96 +1188,6 @@ } } -/* drawVeilUntil ist auff�llen des Bereichs unter der Kurve mit etwas hellerer Farbe - * Xdivide ist nichr benutzt, wird weggelassen in dieser Version - */ -/* -void GFX_graph_print(GFX_DrawCfgScreen *hgfx, const SWindowGimpStyle *window, uint16_t drawVeilUntil, uint8_t Xdivide, uint16_t dataMin, uint16_t dataMax, uint16_t *data, uint16_t datalength, uint8_t color, uint8_t *colour_data) -{ - if(window->bottom > 479) - return; - if(window->top > 479) - return; - if(window->right > 799) - return; - if(window->left > 799) - return; - if(window->bottom < 0) - return; - if(window->top < 0) - return; - if(window->right < 0) - return; - if(window->left < 0) - return; - if(window->bottom <= window->top) - return; - if(window->right <= window->left) - return; - - uint16_t windowwidth = (uint16_t)window->right - (uint16_t)window->left; - - if(dataMax == dataMin) - dataMax++; - - uint8_t invert = 0; - if(dataMin > dataMax) - { - uint16_t dataFlip; - dataFlip = dataMin; - dataMin = dataMax; - dataMax = dataFlip; - invert = 1; - } - else - invert = 0; - - uint16_t dataDelta = 0; - dataDelta = dataMax - dataMin; - - uint8_t colormask = color; - - uint16_t loopX, loopData; - loopX = 0; - loopData = 0; - while((loopX <= windowwidth) & (loopData < datalength)) - { - - } - - - uint32_t pDestination_zero_veil = 0; - uint32_t pDestination = 0; - uint32_t pDestinationOld = 0; - int windowwidth = -1; - int windowheight = -1; - int w1 = -1; - int w2 = -1; - int value = -1; - uint8_t colormask = 0; - - // preparation - windowheight = window->bottom - window->top; - windowwidth = window->right - window->left; - pDestination_zero_veil = hgfx->FBStartAdress + 2 * ( (479 - (drawVeilUntil - 2) ) + ( (window->left) * hgfx->ImageHeight) ); - - while((w1 <= windowwidth) & (w2 < datalength)) - { - // before - if(colour_data != NULL) - { - colormask = color + colour_data[w2]; - } - pDestination = hgfx->FBStartAdress + 2 * ( (479 - (window->top + value) ) + ( (w1 + window->left) * hgfx->ImageHeight) ); - - // after - pDestination_zero_veil += (window->left) * hgfx->ImageHeight; - } -} -*/ - - - // =============================================================================== // GFX_graph_print /// @brief Print all those nice curves, especially in logbook und miniLiveLogGraph @@ -2017,8 +1721,6 @@ } - - /** ****************************************************************************** * @brief GFX write label. / Write string with defined color @@ -3274,7 +2976,7 @@ * @param gfx_selected_language: gfx_selected_language * @retval counter and *cText content */ -int8_t GFX_write__Modify_helper(char *cText, const char *pTextInput, uint8_t gfx_selected_language) +static int8_t GFX_write__Modify_helper(char *cText, const char *pTextInput, uint8_t gfx_selected_language) { uint32_t pText, backup; uint8_t textId; @@ -3374,7 +3076,7 @@ * @retval Ydelta: 0 if text has to start left ( and probably does not fit) */ -uint32_t GFX_write__Modify_Xdelta__Centered(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput) +static uint32_t GFX_write__Modify_Xdelta__Centered(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput) { char cText[101]; uint32_t result; @@ -3444,7 +3146,7 @@ } -uint32_t GFX_write__Modify_Xdelta__RightAlign(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput) +static uint32_t GFX_write__Modify_Xdelta__RightAlign(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput) { char cText[101]; uint32_t result; @@ -3542,8 +3244,6 @@ return result; } - - void GFX_LTDC_Init(void) { /* @@ -3611,171 +3311,6 @@ } } -void GFX_VGA_LTDC_Init_test(void) -{ - - LtdcHandle.Init.HorizontalSync = 48; - /* Vertical synchronization height = Vsync - 1 */ - LtdcHandle.Init.VerticalSync = 3; - /* Accumulated horizontal back porch = Hsync + HBP - 1 */ - LtdcHandle.Init.AccumulatedHBP = 48 + 40 - 1; - /* Accumulated vertical back porch = Vsync + VBP - 1 */ - LtdcHandle.Init.AccumulatedVBP = 3 + 29 - 1; - /* Accumulated active width = Hsync + HBP + Active Width - 1 */ - LtdcHandle.Init.AccumulatedActiveW = 800 + 48 + 40 - 1;//499;//500;//499; - /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */ - LtdcHandle.Init.AccumulatedActiveH = 480 + 3 + 29 - 1; - /* Total width = Hsync + HBP + Active Width + HFP - 1 */ - LtdcHandle.Init.TotalWidth = 800 + 48 + 40 - 1 + 40;//508;//507; - /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */ - LtdcHandle.Init.TotalHeigh = 480 + 3 + 29 - 1 + 13; - - /* Configure R,G,B component values for LCD background color */ - LtdcHandle.Init.Backcolor.Red= 0; - LtdcHandle.Init.Backcolor.Blue= 0; - LtdcHandle.Init.Backcolor.Green= 0; - - /* LCD clock configuration */ - /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */ - /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */ - /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/4 = 48 Mhz */ - /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_8 = 48/4 = 6Mhz */ - -/* done in main.c SystemClockConfig - - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; - PeriphClkInitStruct.PLLSAI.PLLSAIN = 192; - PeriphClkInitStruct.PLLSAI.PLLSAIR = 4; - PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_8; - HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); -*/ - /* Polarity */ - LtdcHandle.Init.HSPolarity = LTDC_HSPOLARITY_AL; - LtdcHandle.Init.VSPolarity = LTDC_VSPOLARITY_AL; - LtdcHandle.Init.DEPolarity = LTDC_DEPOLARITY_AL; - LtdcHandle.Init.PCPolarity = LTDC_PCPOLARITY_IPC;//LTDC_PCPOLARITY_IPC; - - LtdcHandle.Instance = LTDC; - - /* Configure the LTDC */ - if(HAL_LTDC_Init(&LtdcHandle) != HAL_OK) // auch init der GPIO Pins - { - /* Initialization Error */ - GFX_Error_Handler(); - } -} - - -void GFX_VGA_LTDC_Init_org(void) -{ - - LtdcHandle.Init.HorizontalSync = 96; - /* Vertical synchronization height = Vsync - 1 */ - LtdcHandle.Init.VerticalSync = 2; - /* Accumulated horizontal back porch = Hsync + HBP - 1 */ - LtdcHandle.Init.AccumulatedHBP = 96 + 48; - /* Accumulated vertical back porch = Vsync + VBP - 1 */ - LtdcHandle.Init.AccumulatedVBP = 2 + 35; - /* Accumulated active width = Hsync + HBP + Active Width - 1 */ - LtdcHandle.Init.AccumulatedActiveW = 96 + 48 + 800;//499;//500;//499; - /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */ - LtdcHandle.Init.AccumulatedActiveH = 2 + 35 + 480; - /* Total width = Hsync + HBP + Active Width + HFP - 1 */ - LtdcHandle.Init.TotalWidth = 96 + 48 + 800 + 12;//508;//507; - /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */ - LtdcHandle.Init.TotalHeigh = 2 + 35 + 480 + 12; - - /* Configure R,G,B component values for LCD background color */ - LtdcHandle.Init.Backcolor.Red= 0; - LtdcHandle.Init.Backcolor.Blue= 0; - LtdcHandle.Init.Backcolor.Green= 0; - - /* LCD clock configuration */ - /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */ - /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */ - /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/4 = 48 Mhz */ - /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_8 = 48/4 = 6Mhz */ - -/* done in main.c SystemClockConfig - - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; - PeriphClkInitStruct.PLLSAI.PLLSAIN = 192; - PeriphClkInitStruct.PLLSAI.PLLSAIR = 4; - PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_8; - HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); -*/ - /* Polarity */ - LtdcHandle.Init.HSPolarity = LTDC_HSPOLARITY_AL; - LtdcHandle.Init.VSPolarity = LTDC_VSPOLARITY_AH; - LtdcHandle.Init.DEPolarity = LTDC_DEPOLARITY_AL; - LtdcHandle.Init.PCPolarity = LTDC_PCPOLARITY_IPC;//LTDC_PCPOLARITY_IPC; - - LtdcHandle.Instance = LTDC; - - /* Configure the LTDC */ - if(HAL_LTDC_Init(&LtdcHandle) != HAL_OK) // auch init der GPIO Pins - { - /* Initialization Error */ - GFX_Error_Handler(); - } -} - -void GFX_VGA_LTDC_Init(void) -//void GFX_VGA_LTDC_Init_640x480(void) -{ - - LtdcHandle.Init.HorizontalSync = 96; - /* Vertical synchronization height = Vsync - 1 */ - LtdcHandle.Init.VerticalSync = 2; - /* Accumulated horizontal back porch = Hsync + HBP - 1 */ - LtdcHandle.Init.AccumulatedHBP = 96 + 48; - /* Accumulated vertical back porch = Vsync + VBP - 1 */ - LtdcHandle.Init.AccumulatedVBP = 2 + 35; - /* Accumulated active width = Hsync + HBP + Active Width - 1 */ - LtdcHandle.Init.AccumulatedActiveW = 96 + 48 + 640;//499;//500;//499; - /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */ - LtdcHandle.Init.AccumulatedActiveH = 2 + 35 + 480; - /* Total width = Hsync + HBP + Active Width + HFP - 1 */ - LtdcHandle.Init.TotalWidth = 96 + 48 + 640 + 12;//508;//507; - /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */ - LtdcHandle.Init.TotalHeigh = 2 + 35 + 480 + 12; - - /* Configure R,G,B component values for LCD background color */ - LtdcHandle.Init.Backcolor.Red= 0; - LtdcHandle.Init.Backcolor.Blue= 0; - LtdcHandle.Init.Backcolor.Green= 0; - - /* LCD clock configuration */ - /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */ - /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */ - /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/4 = 48 Mhz */ - /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_8 = 48/4 = 6Mhz */ - -/* done in main.c SystemClockConfig - - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; - PeriphClkInitStruct.PLLSAI.PLLSAIN = 192; - PeriphClkInitStruct.PLLSAI.PLLSAIR = 4; - PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_8; - HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); -*/ - /* Polarity */ - LtdcHandle.Init.HSPolarity = LTDC_HSPOLARITY_AL; - LtdcHandle.Init.VSPolarity = LTDC_VSPOLARITY_AH; - LtdcHandle.Init.DEPolarity = LTDC_DEPOLARITY_AL; - LtdcHandle.Init.PCPolarity = LTDC_PCPOLARITY_IPC;//LTDC_PCPOLARITY_IPC; - - LtdcHandle.Instance = LTDC; - - /* Configure the LTDC */ - if(HAL_LTDC_Init(&LtdcHandle) != HAL_OK) // auch init der GPIO Pins - { - /* Initialization Error */ - GFX_Error_Handler(); - } -} - - void GFX_LTDC_LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address) { LTDC_LayerCfgTypeDef Layercfg; @@ -3802,107 +3337,17 @@ HAL_LTDC_EnableCLUT(&LtdcHandle, LayerIndex); } -void GFX_VGA_LTDC_LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address) -{ - LTDC_LayerCfgTypeDef Layercfg; - - /* Layer Init */ - Layercfg.WindowX0 = 0; - Layercfg.WindowX1 = 640; - Layercfg.WindowY0 = 0; - Layercfg.WindowY1 = 480; - Layercfg.PixelFormat = LTDC_PIXEL_FORMAT_AL88;//LTDC_PIXEL_FORMAT_ARGB8888; - Layercfg.FBStartAdress = FB_Address; - Layercfg.Alpha = 255; - Layercfg.Alpha0 = 0; - Layercfg.Backcolor.Blue = 0; - Layercfg.Backcolor.Green = 0; - Layercfg.Backcolor.Red = 0; - Layercfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA; - Layercfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA; - Layercfg.ImageWidth = 640; - Layercfg.ImageHeight = 480; - - HAL_LTDC_ConfigCLUT(&LtdcHandle, ColorLUT, CLUT_END, LayerIndex); - HAL_LTDC_ConfigLayer(&LtdcHandle, &Layercfg, LayerIndex); - HAL_LTDC_EnableCLUT(&LtdcHandle, LayerIndex); -} - -void GFX_LTDC_LayerTESTInit(uint16_t LayerIndex, uint32_t FB_Address) -{ - LTDC_LayerCfgTypeDef Layercfg; - - /* Layer Init */ - Layercfg.WindowX0 = 0; - Layercfg.WindowX1 = 390; - Layercfg.WindowY0 = 0; - Layercfg.WindowY1 = 800; - Layercfg.PixelFormat = LTDC_PIXEL_FORMAT_AL88;//LTDC_PIXEL_FORMAT_ARGB8888; - Layercfg.FBStartAdress = FB_Address; - Layercfg.Alpha = 255; - Layercfg.Alpha0 = 255; - Layercfg.Backcolor.Blue = 0; - Layercfg.Backcolor.Green = 0; - Layercfg.Backcolor.Red = 200; - Layercfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA; - Layercfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA; - Layercfg.ImageWidth = 480; - Layercfg.ImageHeight = 800; - - HAL_LTDC_ConfigCLUT(&LtdcHandle, ColorLUT, CLUT_END, LayerIndex); - HAL_LTDC_ConfigLayer(&LtdcHandle, &Layercfg, LayerIndex); - HAL_LTDC_EnableCLUT(&LtdcHandle, LayerIndex); -} - - -uint32_t GFX_doubleBufferOne(void) +static uint32_t GFX_doubleBufferOne(void) { return SDRAM_DOUBLE_BUFFER_ONE; } -uint32_t GFX_doubleBufferTwo(void) +static uint32_t GFX_doubleBufferTwo(void) { return SDRAM_DOUBLE_BUFFER_TWO; } -/* -void doubleBufferClear(uint32_t pDestination) -{ - for(uint32_t i = 2*200*480; i > 0; i--) - { - *(__IO uint16_t*)pDestination = 0; - pDestination += 2; - *(__IO uint16_t*)pDestination = 0; - pDestination += 2; - *(__IO uint16_t*)pDestination = 0; - pDestination += 2; - *(__IO uint16_t*)pDestination = 0; - pDestination += 2; - } -} - - -void GFX_doubleBufferClearOne(void) -{ - doubleBufferClear(SDRAM_DOUBLE_BUFFER_ONE); -} - - -void GFX_doubleBufferClearTwo(void) -{ - doubleBufferClear(SDRAM_DOUBLE_BUFFER_TWO); -} -*/ - -uint32_t getFrameByNumber(uint8_t ZeroToMaxFrames) -{ - if(ZeroToMaxFrames >= MAXFRAMES) - return 0; - else - return frame[ZeroToMaxFrames].StartAddress; -} - uint32_t getFrame(uint8_t callerId) { uint8_t i; @@ -3988,15 +3433,6 @@ } -uint8_t getFrameCount(uint8_t frameId) -{ - if(frameId < (MAXFRAMECOUNTER - 3)) - return frameCounter[frameId]; - else - return frameCounter[MAXFRAMECOUNTER - 2]; -} - - void housekeepingFrame(void) { static uint8_t countLogClear = 0;