Display something
This commit is contained in:
		
							
								
								
									
										14435
									
								
								Core/Inc/ft_logo_orange.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14435
									
								
								Core/Inc/ft_logo_orange.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												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;
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user