Display something
This commit is contained in:
parent
0739746d4d
commit
50cfe87592
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,10 @@
|
|||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include "ft_logo_orange.h"
|
||||
#include "stm32h7xx_hal.h"
|
||||
#include "stm32h7xx_hal_ltdc.h"
|
||||
#include <stdint.h>
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
|
@ -91,14 +94,21 @@ void DISP_WriteReg(uint8_t addr, uint8_t *data, size_t data_len) {
|
|||
}
|
||||
|
||||
void DISP_Init() {
|
||||
// SET password
|
||||
// B9h: Enable extended commands
|
||||
uint8_t data0[] = {0xFF, 0x83, 0x57};
|
||||
DISP_WriteReg(0xB9, data0, sizeof(data0));
|
||||
// SET power
|
||||
// B1h: Set power control
|
||||
uint8_t data1[] = {0x00, 0x16, 0x1C, 0x1C, 0xC3, 0x5C};
|
||||
DISP_WriteReg(0xB1, data1, sizeof(data1));
|
||||
// ?
|
||||
uint8_t data2[] = {0x53, 0x00, 0x05, 0x05};
|
||||
// B3h: Set RGB interface
|
||||
// Disable SDO pin
|
||||
// Write directly to display (not internal GRAM)
|
||||
// Data read on rising edge of DCLK
|
||||
// HSYNC & VSYNC Activ low
|
||||
// DE Active high
|
||||
// Horizontal front porch 5
|
||||
// Vertical front porch 2
|
||||
uint8_t data2[] = {0x53, 0x00, 0x05, 0x02};
|
||||
DISP_WriteReg(0xB3, data2, sizeof(data2));
|
||||
// SET cyc
|
||||
uint8_t data3[] = {0x32, 0x40, 0x00, 0x2A, 0x2A, 0x0D, 0x78};
|
||||
|
@ -138,6 +148,7 @@ void DISP_Init() {
|
|||
// Normal display mode
|
||||
DISP_WriteReg(0x13, NULL, 0);
|
||||
// Display on
|
||||
DISP_WriteReg(0x29, NULL, 0);
|
||||
}
|
||||
/* USER CODE END 0 */
|
||||
|
||||
|
@ -172,17 +183,21 @@ int main(void) {
|
|||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_LTDC_Init();
|
||||
MX_USART3_UART_Init();
|
||||
MX_USB_OTG_HS_USB_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
HAL_GPIO_WritePin(SPI1_CSX_GPIO_Port, SPI1_CSX_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(SPI1_SCL_GPIO_Port, SPI1_SCL_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(DISP_RESET_GPIO_Port, DISP_RESET_Pin, GPIO_PIN_RESET);
|
||||
HAL_Delay(1000);
|
||||
HAL_Delay(150);
|
||||
HAL_GPIO_WritePin(DISP_RESET_GPIO_Port, DISP_RESET_Pin, GPIO_PIN_SET);
|
||||
HAL_Delay(1000);
|
||||
HAL_Delay(150);
|
||||
DISP_Init();
|
||||
HAL_Delay(500);
|
||||
MX_LTDC_Init();
|
||||
// if (HAL_LTDC_Reload(&hltdc, LTDC_RELOAD_IMMEDIATE) != HAL_OK) {
|
||||
// Error_Handler();
|
||||
// }
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
|
@ -282,34 +297,34 @@ static void MX_LTDC_Init(void) {
|
|||
hltdc.Instance = LTDC;
|
||||
hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;
|
||||
hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;
|
||||
hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AH;
|
||||
hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;
|
||||
hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
|
||||
hltdc.Init.HorizontalSync = 5;
|
||||
hltdc.Init.VerticalSync = 2;
|
||||
hltdc.Init.AccumulatedHBP = 10;
|
||||
hltdc.Init.AccumulatedVBP = 4;
|
||||
hltdc.Init.AccumulatedActiveW = 330;
|
||||
hltdc.Init.AccumulatedActiveH = 484;
|
||||
hltdc.Init.TotalWidth = 335;
|
||||
hltdc.Init.TotalHeigh = 486;
|
||||
hltdc.Init.HorizontalSync = 4;
|
||||
hltdc.Init.VerticalSync = 1;
|
||||
hltdc.Init.AccumulatedHBP = 9;
|
||||
hltdc.Init.AccumulatedVBP = 3;
|
||||
hltdc.Init.AccumulatedActiveW = 329;
|
||||
hltdc.Init.AccumulatedActiveH = 483;
|
||||
hltdc.Init.TotalWidth = 334;
|
||||
hltdc.Init.TotalHeigh = 485;
|
||||
hltdc.Init.Backcolor.Blue = 0;
|
||||
hltdc.Init.Backcolor.Green = 0;
|
||||
hltdc.Init.Backcolor.Green = 255;
|
||||
hltdc.Init.Backcolor.Red = 255;
|
||||
if (HAL_LTDC_Init(&hltdc) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
pLayerCfg.WindowX0 = 0;
|
||||
pLayerCfg.WindowX1 = 0;
|
||||
pLayerCfg.WindowX1 = 320;
|
||||
pLayerCfg.WindowY0 = 0;
|
||||
pLayerCfg.WindowY1 = 0;
|
||||
pLayerCfg.WindowY1 = 480;
|
||||
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB888;
|
||||
pLayerCfg.Alpha = 0;
|
||||
pLayerCfg.Alpha = 255;
|
||||
pLayerCfg.Alpha0 = 0;
|
||||
pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
|
||||
pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
|
||||
pLayerCfg.FBStartAdress = 0;
|
||||
pLayerCfg.ImageWidth = 0;
|
||||
pLayerCfg.ImageHeight = 0;
|
||||
pLayerCfg.FBStartAdress = (uint32_t)&image_data_ft_logo_orange;
|
||||
pLayerCfg.ImageWidth = 320;
|
||||
pLayerCfg.ImageHeight = 480;
|
||||
pLayerCfg.Backcolor.Blue = 0;
|
||||
pLayerCfg.Backcolor.Green = 0;
|
||||
pLayerCfg.Backcolor.Red = 0;
|
||||
|
|
|
@ -5,17 +5,21 @@ File.Version=6
|
|||
GPIO.groupedBy=Group By Peripherals
|
||||
KeepUserPlacement=true
|
||||
LTDC.ActiveW=320
|
||||
LTDC.Alpha_L0=255
|
||||
LTDC.DEPolarity=LTDC_DEPOLARITY_AH
|
||||
LTDC.Green=255
|
||||
LTDC.HBP=5
|
||||
LTDC.HFP=5
|
||||
LTDC.HSync=6
|
||||
LTDC.IPParameters=ActiveW,HSync,HBP,HFP,VSync,DEPolarity,Layers,PixelFormat_L0,WindowX1_L0,WindowY1_L0,Red
|
||||
LTDC.HSync=5
|
||||
LTDC.IPParameters=ActiveW,HSync,HBP,HFP,VSync,DEPolarity,Layers,PixelFormat_L0,WindowX1_L0,WindowY1_L0,Red,Green,Alpha_L0,ImageWidth_L0,ImageHeight_L0
|
||||
LTDC.ImageHeight_L0=480
|
||||
LTDC.ImageWidth_L0=320
|
||||
LTDC.Layers=0
|
||||
LTDC.PixelFormat_L0=LTDC_PIXEL_FORMAT_RGB888
|
||||
LTDC.Red=255
|
||||
LTDC.VSync=3
|
||||
LTDC.WindowX1_L0=0
|
||||
LTDC.WindowY1_L0=0
|
||||
LTDC.VSync=2
|
||||
LTDC.WindowX1_L0=320
|
||||
LTDC.WindowY1_L0=480
|
||||
Mcu.CPN=STM32H7A3ZIT6Q
|
||||
Mcu.Family=STM32H7
|
||||
Mcu.IP0=CORTEX_M7
|
||||
|
|
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
|||
##########################################################################################################################
|
||||
# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Tue Jan 17 17:33:34 CET 2023]
|
||||
# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Tue Jan 17 17:58:08 CET 2023]
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue