changes to ioc file that also doesn't work

This commit is contained in:
2025-04-04 00:43:38 +02:00
parent dd3dacbc63
commit cace5823ac
7 changed files with 881 additions and 909 deletions

View File

@ -58,7 +58,7 @@ PCD_HandleTypeDef hpcd_USB_OTG_HS;
SDRAM_HandleTypeDef hsdram1;
/* USER CODE BEGIN PV */
// uint32_t framebuffer[480*272];
uint16_t* framebuffer = (uint16_t*)0xC0000000;
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
@ -119,35 +119,14 @@ int main(void)
MX_LTDC_Init();
MX_CRC_Init();
/* USER CODE BEGIN 2 */
// uint8_t r = 0xff, g = 0xff, b = 0xff; // Solid red
// uint32_t col = ((r>>2)<<12) | ((g>>2)<<6) | (b>>2); // Convert colors to RGB565
// // Put colors into the framebuffer
// for(int i = 0; i < 480*272; i++)
// {
// framebuffer[i] = col;
// }
uint8_t r = 0xff, g = 0x00, b = 0xff;
uint16_t col = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3); // Convert colors to RGB565
// Put colors into the framebuffer
for(int i = 0; i < 1024*600; i++)
{
framebuffer[i] = col;
}
// HAL_LTDC_SetAddress(&hltdc, (uint32_t)framebuffer, LTDC_LAYER_1);
volatile uint32_t *externalRAM = (uint32_t *) 0xD0000000;
const uint32_t size = 1000;
//write external RAM
// for(int i = 0; i < size; i++)
// {
// externalRAM[i] = i;
// }
// for(int i = 0; i < size; i++)
// {
// if (externalRAM[i] != i) {
// while (1) {}
// }
// }
uint8_t wdata[] = {0x1, 0x2, 0x3, 0x4, 0x5};
uint8_t rdata[10];
memcpy((uint32_t *) 0xC0000000, wdata, 5);
memcpy(rdata, (uint32_t *) 0xC0000000, 5);
/* USER CODE END 2 */
/* Infinite loop */
@ -376,18 +355,18 @@ static void MX_LTDC_Init(void)
hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;
hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;
hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;
hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
hltdc.Init.HorizontalSync = 19;
hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IIPC;
hltdc.Init.HorizontalSync = 9;
hltdc.Init.VerticalSync = 2;
hltdc.Init.AccumulatedHBP = 159;
hltdc.Init.AccumulatedVBP = 22;
hltdc.Init.AccumulatedActiveW = 1183;
hltdc.Init.AccumulatedActiveH = 622;
hltdc.Init.TotalWidth = 1343;
hltdc.Init.TotalHeigh = 634;
hltdc.Init.Backcolor.Blue = 0;
hltdc.Init.Backcolor.Green = 0;
hltdc.Init.Backcolor.Red = 0;
hltdc.Init.AccumulatedHBP = 149;
hltdc.Init.AccumulatedVBP = 7;
hltdc.Init.AccumulatedActiveW = 1173;
hltdc.Init.AccumulatedActiveH = 607;
hltdc.Init.TotalWidth = 1333;
hltdc.Init.TotalHeigh = 609;
hltdc.Init.Backcolor.Blue = 255;
hltdc.Init.Backcolor.Green = 255;
hltdc.Init.Backcolor.Red = 255;
if (HAL_LTDC_Init(&hltdc) != HAL_OK)
{
Error_Handler();
@ -396,12 +375,12 @@ static void MX_LTDC_Init(void)
pLayerCfg.WindowX1 = 1024;
pLayerCfg.WindowY0 = 0;
pLayerCfg.WindowY1 = 600;
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB888;
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
pLayerCfg.Alpha = 1;
pLayerCfg.Alpha0 = 0;
pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
pLayerCfg.FBStartAdress = 201326592;
pLayerCfg.FBStartAdress = 0xC0000000;
pLayerCfg.ImageWidth = 1024;
pLayerCfg.ImageHeight = 600;
pLayerCfg.Backcolor.Blue = 100;
@ -412,7 +391,7 @@ static void MX_LTDC_Init(void)
Error_Handler();
}
/* USER CODE BEGIN LTDC_Init 2 */
LTDC->IER |= LTDC_IER_LIE; // Enable LTDC interrupts
/* USER CODE END LTDC_Init 2 */
}
@ -646,7 +625,10 @@ static void MX_GPIO_Init(void)
HAL_GPIO_WritePin(GPIOF, STATUS_LED_1_Pin|STATUS_LED_2_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, Display_Reset_Pin|Display_Standby_Pin|Display_Left_Right_Pin|Display_Up_Down_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOC, Display_Reset_Pin|Display_Left_Right_Pin|Display_Up_Down_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(Display_Standby_GPIO_Port, Display_Standby_Pin, GPIO_PIN_SET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(Charger_Relay_GPIO_Port, Charger_Relay_Pin, GPIO_PIN_RESET);