From 26085432aa213f7dd75b59c06e9b40c444992ffa Mon Sep 17 00:00:00 2001 From: RTwTools Date: Wed, 30 Nov 2022 09:32:48 +0100 Subject: [PATCH] B-08 - NT35510 --- Core/Src/main.c | 15 +- Drivers/BSP/Components/nt35510/nt35510.c | 252 ++++++++++++++++++ Drivers/BSP/Components/nt35510/nt35510.h | 249 +++++++++++++++++ .../STM32469I-Discovery/stm32469i_discovery.c | 11 + STM32CubeIDE/.project | 5 + STM32F469I-DISCO.ioc | 24 +- TouchGFX/assets/texts/texts.xml | 4 +- TouchGFX/generated/texts/src/LanguageGb.cpp | 16 -- TouchGFX/generated/texts/src/Texts.cpp | 127 --------- gcc/Makefile | 1 + 10 files changed, 541 insertions(+), 163 deletions(-) create mode 100644 Drivers/BSP/Components/nt35510/nt35510.c create mode 100644 Drivers/BSP/Components/nt35510/nt35510.h delete mode 100644 TouchGFX/generated/texts/src/LanguageGb.cpp delete mode 100644 TouchGFX/generated/texts/src/Texts.cpp diff --git a/Core/Src/main.c b/Core/Src/main.c index 4de2051..7d3e689 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -25,6 +25,7 @@ /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "../Components/otm8009a/otm8009a.h" +#include "../Components/nt35510/nt35510.h" #include "stm32469i_discovery_sdram.h" #include "stm32469i_discovery_qspi.h" /* USER CODE END Includes */ @@ -403,10 +404,10 @@ static void MX_DSIHOST_DSI_Init(void) CmdCfg.CommandSize = 200; CmdCfg.TearingEffectSource = DSI_TE_EXTERNAL; CmdCfg.TearingEffectPolarity = DSI_TE_RISING_EDGE; - CmdCfg.HSPolarity = DSI_HSYNC_ACTIVE_LOW; - CmdCfg.VSPolarity = DSI_VSYNC_ACTIVE_LOW; + CmdCfg.HSPolarity = DSI_HSYNC_ACTIVE_HIGH; + CmdCfg.VSPolarity = DSI_VSYNC_ACTIVE_HIGH; CmdCfg.DEPolarity = DSI_DATA_ENABLE_ACTIVE_HIGH; - CmdCfg.VSyncPol = DSI_VSYNC_FALLING; + CmdCfg.VSyncPol = DSI_VSYNC_RISING; CmdCfg.AutomaticRefresh = DSI_AR_DISABLE; CmdCfg.TEAcknowledgeRequest = DSI_TE_ACKNOWLEDGE_ENABLE; if (HAL_DSI_ConfigAdaptedCommandMode(&hdsi, &CmdCfg) != HAL_OK) @@ -475,8 +476,8 @@ static void MX_LTDC_Init(void) /* USER CODE END LTDC_Init 1 */ hltdc.Instance = LTDC; - hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL; - hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL; + hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AH; + hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AH; hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL; hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC; hltdc.Init.HorizontalSync = 1; @@ -518,7 +519,7 @@ static void MX_LTDC_Init(void) DSI_LPCmdTypeDef LPCmd; HAL_DSI_Start(&hdsi); - OTM8009A_Init(OTM8009A_FORMAT_RBG565, LCD_ORIENTATION_LANDSCAPE); + NT35510_Init(NT35510_FORMAT_RGB565, LCD_ORIENTATION_LANDSCAPE); HAL_DSI_ShortWrite(&hdsi, 0, DSI_DCS_SHORT_PKT_WRITE_P1, OTM8009A_CMD_DISPOFF, 0x00); LPCmd.LPGenShortWriteNoP = DSI_LP_GSW0P_DISABLE; @@ -691,7 +692,7 @@ static void MX_GPIO_Init(void) /*Configure GPIO pin : PH7 */ GPIO_InitStruct.Pin = GPIO_PIN_7; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); diff --git a/Drivers/BSP/Components/nt35510/nt35510.c b/Drivers/BSP/Components/nt35510/nt35510.c new file mode 100644 index 0000000..08b3973 --- /dev/null +++ b/Drivers/BSP/Components/nt35510/nt35510.c @@ -0,0 +1,252 @@ +/** + ****************************************************************************** + * @file nt35510.c + * @author MCD Application Team + * @brief This file provides the LCD Driver for Frida Techshine 3K138 (WVGA) + * DSI LCD Display NT35510. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "nt35510.h" +#include +#include + + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @defgroup NT35510 NT35510 + * @brief This file provides a set of functions needed to drive the + * NT35510 IC display driver. + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup NT35510_Private_Constants NT35510 Private Constants + * @{ + */ + +/* + * @brief Constant tables of register settings used to transmit DSI + * command packets as power up initialization sequence of the Frida 3K138 + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** @defgroup NT35510_Exported_Variables + * @{ + */ + +/** + * @} + */ + +/* Exported functions ---------------------------------------------------------*/ +/** @defgroup NT35510_Exported_Functions OTM8009A Exported Functions + * @{ + */ + +/** + * @brief Initializes the LCD Frida display part by communication in DSI mode in Video Mode + * with IC Display Driver NT35510 (see IC Driver specification for more information). + * @param hdsi_eval : pointer on DSI configuration structure + * @param hdsivideo_handle : pointer on DSI video mode configuration structure + * @retval Status + */ +uint8_t NT35510_Init(uint32_t ColorCoding, uint32_t orientation) +{ + NT35510_IO_Delay(120); + +/* ************************************************************************** */ +/* Proprietary Initialization */ +/* ************************************************************************** */ + const uint8_t nt35510_reg[] = {0x55, 0xAA, 0x52, 0x08, 0x01, 0xF0}; + const uint8_t nt35510_reg1[] = {0x03, 0x03, 0x03, 0xB0}; + const uint8_t nt35510_reg2[] = {0x46, 0x46, 0x46, 0xB6}; + const uint8_t nt35510_reg3[] = {0x03, 0x03, 0x03, 0xB1}; + const uint8_t nt35510_reg4[] = {0x36, 0x36, 0x36, 0xB7}; + const uint8_t nt35510_reg5[] = {0x00, 0x00, 0x02, 0xB2}; + const uint8_t nt35510_reg6[] = {0x26, 0x26, 0x26, 0xB8}; + const uint8_t nt35510_reg7[] = {0xBF, 0x01}; + const uint8_t nt35510_reg8[] = {0x09, 0x09, 0x09, 0xB3}; + const uint8_t nt35510_reg9[] = {0x36, 0x36, 0x36, 0xB9}; + const uint8_t nt35510_reg10[] = {0x08, 0x08, 0x08, 0xB5}; + const uint8_t nt35510_reg12[] = {0x26, 0x26, 0x26, 0xBA}; + const uint8_t nt35510_reg13[] = {0x00, 0x80, 0x00, 0xBC}; + const uint8_t nt35510_reg14[] = {0x00, 0x80, 0x00, 0xBD}; + const uint8_t nt35510_reg15[] = {0x00, 0x50, 0xBE}; + const uint8_t nt35510_reg16[] = {0x55, 0xAA, 0x52, 0x08, 0x00, 0xF0}; + const uint8_t nt35510_reg17[] = {0xFC, 0x00, 0xB1}; + const uint8_t nt35510_reg18[] = {0xB6, 0x03}; + const uint8_t nt35510_reg19[] = {0xB5, 0x51}; + const uint8_t nt35510_reg20[] = {0x00, 0x00, 0xB7}; + const uint8_t nt35510_reg21[] = {0x01, 0x02, 0x02, 0x02, 0xB8}; + const uint8_t nt35510_reg22[] = {0x00, 0x00, 0x00, 0xBC}; + const uint8_t nt35510_reg23[] = {0x03, 0x00, 0x00, 0xCC}; + const uint8_t nt35510_reg24[] = {0xBA, 0x01}; + const uint8_t nt35510_madctl_portrait[] = {NT35510_CMD_MADCTL ,0x00}; + const uint8_t nt35510_caset_portrait[] = {0x00, 0x00, 0x01, 0xDF ,NT35510_CMD_CASET}; + const uint8_t nt35510_raset_portrait[] = {0x00, 0x00, 0x03, 0x1F ,NT35510_CMD_RASET}; + const uint8_t nt35510_madctl_landscape[] = {NT35510_CMD_MADCTL, 0x60}; + const uint8_t nt35510_caset_landscape[] = {0x00, 0x00, 0x03, 0x1F ,NT35510_CMD_CASET}; + const uint8_t nt35510_raset_landscape[] = {0x00, 0x00, 0x01, 0xDF ,NT35510_CMD_RASET}; + const uint8_t nt35510_reg26[] = {NT35510_CMD_TEEON, 0x00}; /* Tear on */ + const uint8_t nt35510_reg27[] = {NT35510_CMD_SLPOUT, 0x00}; /* Sleep out */ + const uint8_t nt35510_reg30[] = {NT35510_CMD_DISPON, 0x00}; + + const uint8_t nt35510_reg31[] = {NT35510_CMD_WRDISBV, 0x7F}; + const uint8_t nt35510_reg32[] = {NT35510_CMD_WRCTRLD, 0x2C}; + const uint8_t nt35510_reg33[] = {NT35510_CMD_WRCABC, 0x02}; + const uint8_t nt35510_reg34[] = {NT35510_CMD_WRCABCMB, 0xFF}; + const uint8_t nt35510_reg35[] = {NT35510_CMD_RAMWR, 0x00}; + const uint8_t nt35510_reg36[] = {NT35510_CMD_COLMOD, NT35510_COLMOD_RGB565}; + const uint8_t nt35510_reg37[] = {NT35510_CMD_COLMOD, NT35510_COLMOD_RGB888}; + + DSI_IO_WriteCmd(5, (uint8_t *)nt35510_reg); /* LV2: Page 1 enable */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg1);/* AVDD: 5.2V */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg2);/* AVDD: Ratio */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg3);/* AVEE: -5.2V */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg4);/* AVEE: Ratio */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg5);/* VCL: -2.5V */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg6);/* VCL: Ratio */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg7);/* VGH: 15V (Free Pump) */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg8); + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg9);/* VGH: Ratio */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg10);/* VGL_REG: -10V */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg12);/* VGLX: Ratio */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg13);/* VGMP/VGSP: 4.5V/0V */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg14);/* VGMN/VGSN:-4.5V/0V */ + DSI_IO_WriteCmd(2, (uint8_t *)nt35510_reg15);/* VCOM: -1.325V */ + +/* ************************************************************************** */ +/* Proprietary DCS Initialization */ +/* ************************************************************************** */ + DSI_IO_WriteCmd(5, (uint8_t *)nt35510_reg16);/* LV2: Page 0 enable */ + DSI_IO_WriteCmd(2, (uint8_t *)nt35510_reg17);/* Display control */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg18);/* Src hold time */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg19); + DSI_IO_WriteCmd(2, (uint8_t *)nt35510_reg20);/* Gate EQ control */ + DSI_IO_WriteCmd(4, (uint8_t *)nt35510_reg21);/* Src EQ control(Mode2) */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg22);/* Inv. mode(2-dot) */ + DSI_IO_WriteCmd(3, (uint8_t *)nt35510_reg23); + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg24); + /* Tear on */ + DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg26); + /* Set Pixel color format to RGB888 */ + DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg37); + +/* ************************************************************************** */ +/* Standard DCS Initialization */ +/* ************************************************************************** */ + + /* Add a delay, otherwise MADCTL not taken */ + NT35510_IO_Delay(200); + + /* Configure orientation */ + if(orientation == NT35510_ORIENTATION_PORTRAIT) + { + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_madctl_portrait); + DSI_IO_WriteCmd(4, (uint8_t *)nt35510_caset_portrait); + DSI_IO_WriteCmd(4, (uint8_t *)nt35510_raset_portrait); + } + else + { + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_madctl_landscape); + DSI_IO_WriteCmd(4, (uint8_t *)nt35510_caset_landscape); + DSI_IO_WriteCmd(4, (uint8_t *)nt35510_raset_landscape); + } + + DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg27); + /* Wait for sleep out exit */ + NT35510_IO_Delay(120); + + switch(ColorCoding) + { + case NT35510_FORMAT_RGB565 : + /* Set Pixel color format to RGB565 */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg36); + break; + case NT35510_FORMAT_RGB888 : + /* Set Pixel color format to RGB888 */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg37); + break; + default : + /* Set Pixel color format to RGB888 */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg37); + break; + } + + /** CABC : Content Adaptive Backlight Control section start >> */ + /* Note : defaut is 0 (lowest Brightness), 0xFF is highest Brightness, try 0x7F : intermediate value */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg31); + /* defaut is 0, try 0x2C - Brightness Control Block, Display Dimming & BackLight on */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg32); + /* defaut is 0, try 0x02 - image Content based Adaptive Brightness [Still Picture] */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg33); + /* defaut is 0 (lowest Brightness), 0xFF is highest Brightness */ + DSI_IO_WriteCmd(1, (uint8_t *)nt35510_reg34); + /** CABC : Content Adaptive Backlight Control section end << */ + + /* Display on */ + DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg30); + + /* Send Command GRAM memory write (no parameters) : this initiates frame write via other DSI commands sent by */ + /* DSI host from LTDC incoming pixels in video mode */ + DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg35); + + return 0; +} + + +/** + * @} + */ + +uint8_t NT35510_DeInit(void) +{ + const uint8_t nt35510_reg30b[] = {NT35510_CMD_DISPOFF, 0x00}; + const uint8_t nt35510_reg27b[] = {NT35510_CMD_SLPIN, 0x00}; + /* Display off */ + DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg30b); + NT35510_IO_Delay(120); + /* Sleep in */ + DSI_IO_WriteCmd(0, (uint8_t *)nt35510_reg27b); + return 0; +} + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/nt35510/nt35510.h b/Drivers/BSP/Components/nt35510/nt35510.h new file mode 100644 index 0000000..2740160 --- /dev/null +++ b/Drivers/BSP/Components/nt35510/nt35510.h @@ -0,0 +1,249 @@ +/** + ****************************************************************************** + * @file nt35510.h + * @author MCD Application Team + * @brief This file contains all the constants parameters for the NT35510 + * which is the LCD Driver for Frida Techshine 3K138 (WVGA) + * DSI LCD Display. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __NT35510_H +#define __NT35510_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup nt35510 + * @{ + */ + +/** @addtogroup NT35510_Exported_Variables + * @{ + */ + +#if defined ( __GNUC__ ) +#ifndef __weak +#define __weak __attribute__((weak)) +#endif /* __weak */ +#endif /* __GNUC__ */ + +/** + * @brief LCD_OrientationTypeDef + * Possible values of Display Orientation + */ +#define NT35510_ORIENTATION_PORTRAIT ((uint32_t)0x00) /* Portrait orientation choice of LCD screen */ +#define NT35510_ORIENTATION_LANDSCAPE ((uint32_t)0x01) /* Landscape orientation choice of LCD screen */ + +/** + * @brief Possible values of + * pixel data format (ie color coding) transmitted on DSI Data lane in DSI packets + */ +#define NT35510_FORMAT_RGB888 ((uint32_t)0x00) /* Pixel format chosen is RGB888 : 24 bpp */ +#define NT35510_FORMAT_RGB565 ((uint32_t)0x02) /* Pixel format chosen is RGB565 : 16 bpp */ + +/** + * @brief nt35510_480x800 Size + */ + +/* Width and Height in Portrait mode */ +#define NT35510_480X800_WIDTH ((uint16_t)480) /* LCD PIXEL WIDTH */ +#define NT35510_480X800_HEIGHT ((uint16_t)800) /* LCD PIXEL HEIGHT */ + +/* Width and Height in Landscape mode */ +#define NT35510_800X480_WIDTH ((uint16_t)800) /* LCD PIXEL WIDTH */ +#define NT35510_800X480_HEIGHT ((uint16_t)480) /* LCD PIXEL HEIGHT */ + +/** + * @brief NT35510_480X800 Timing parameters for Portrait orientation mode + */ +#define NT35510_480X800_HSYNC ((uint16_t)2) /* Horizontal synchronization */ +#define NT35510_480X800_HBP ((uint16_t)34) /* Horizontal back porch */ +#define NT35510_480X800_HFP ((uint16_t)34) /* Horizontal front porch */ + +#define NT35510_480X800_VSYNC ((uint16_t)120) /* Vertical synchronization */ +#define NT35510_480X800_VBP ((uint16_t)150) /* Vertical back porch */ +#define NT35510_480X800_VFP ((uint16_t)150) /* Vertical front porch */ + +/** + * @brief NT35510_800X480 Timing parameters for Landscape orientation mode + * Same values as for Portrait mode in fact. + */ +#define NT35510_800X480_HSYNC NT35510_480X800_VSYNC /* Horizontal synchronization */ +#define NT35510_800X480_HBP NT35510_480X800_VBP /* Horizontal back porch */ +#define NT35510_800X480_HFP NT35510_480X800_VFP /* Horizontal front porch */ +#define NT35510_800X480_VSYNC NT35510_480X800_HSYNC /* Vertical synchronization */ +#define NT35510_800X480_VBP NT35510_480X800_HBP /* Vertical back porch */ +#define NT35510_800X480_VFP NT35510_480X800_HFP /* Vertical front porch */ + + +/* List of NT35510 used commands */ +/* Detailed in NT35510 Data Sheet v0.80 */ +/* Version of 10/28/2011 */ +/* Command, NumberOfArguments */ + +#define NT35510_CMD_NOP 0x00 /* NOP */ +#define NT35510_CMD_SWRESET 0x01 /* SW reset */ +#define NT35510_CMD_RDDID 0x04 /* Read display ID */ +#define NT35510_CMD_RDNUMED 0x05 /* Read number of errors on DSI */ +#define NT35510_CMD_RDDPM 0x0A /* Read display power mode */ +#define NT35510_CMD_RDDMADCTL 0x0B /* Read display MADCTL */ +#define NT35510_CMD_RDDCOLMOD 0x0C /* Read display pixel format */ +#define NT35510_CMD_RDDIM 0x0D /* Read display image mode */ +#define NT35510_CMD_RDDSM 0x0E /* Read display signal mode */ +#define NT35510_CMD_RDDSDR 0x0F /* Read display self-diagnostics result */ +#define NT35510_CMD_SLPIN 0x10 /* Sleep in */ +#define NT35510_CMD_SLPOUT 0x11 /* Sleep out */ +#define NT35510_CMD_PTLON 0x12 /* Partial mode on */ +#define NT35510_CMD_NORON 0x13 /* Normal display mode on */ +#define NT35510_CMD_INVOFF 0x20 /* Display inversion off */ +#define NT35510_CMD_INVON 0x21 /* Display inversion on */ +#define NT35510_CMD_ALLPOFF 0x22 /* All pixel off */ +#define NT35510_CMD_ALLPON 0x23 /* All pixel on */ +#define NT35510_CMD_GAMSET 0x26 /* Gamma set */ +#define NT35510_CMD_DISPOFF 0x28 /* Display off */ +#define NT35510_CMD_DISPON 0x29 /* Display on */ +#define NT35510_CMD_CASET 0x2A /* Column address set */ +#define NT35510_CMD_RASET 0x2B /* Row address set */ +#define NT35510_CMD_RAMWR 0x2C /* Memory write */ +#define NT35510_CMD_RAMRD 0x2E /* Memory read */ +#define NT35510_CMD_PLTAR 0x30 /* Partial area */ +#define NT35510_CMD_TOPC 0x32 /* Turn On Peripheral Command */ +#define NT35510_CMD_TEOFF 0x34 /* Tearing effect line off */ +#define NT35510_CMD_TEEON 0x35 /* Tearing effect line on */ +#define NT35510_CMD_MADCTL 0x36 /* Memory data access control */ +#define NT35510_CMD_IDMOFF 0x38 /* Idle mode off */ +#define NT35510_CMD_IDMON 0x39 /* Idle mode on */ +#define NT35510_CMD_COLMOD 0x3A /* Interface pixel format */ +#define NT35510_CMD_RAMWRC 0x3C /* Memory write continue */ +#define NT35510_CMD_RAMRDC 0x3E /* Memory read continue */ +#define NT35510_CMD_STESL 0x44 /* Set tearing effect scan line */ +#define NT35510_CMD_GSL 0x45 /* Get scan line */ + +#define NT35510_CMD_DSTBON 0x4F /* Deep standby mode on */ +#define NT35510_CMD_WRPFD 0x50 /* Write profile value for display */ +#define NT35510_CMD_WRDISBV 0x51 /* Write display brightness */ +#define NT35510_CMD_RDDISBV 0x52 /* Read display brightness */ +#define NT35510_CMD_WRCTRLD 0x53 /* Write CTRL display */ +#define NT35510_CMD_RDCTRLD 0x54 /* Read CTRL display value */ +#define NT35510_CMD_WRCABC 0x55 /* Write content adaptative brightness control */ +#define NT35510_CMD_RDCABC 0x56 /* Read content adaptive brightness control */ +#define NT35510_CMD_WRHYSTE 0x57 /* Write hysteresis */ +#define NT35510_CMD_WRGAMMSET 0x58 /* Write gamme setting */ +#define NT35510_CMD_RDFSVM 0x5A /* Read FS value MSBs */ +#define NT35510_CMD_RDFSVL 0x5B /* Read FS value LSBs */ +#define NT35510_CMD_RDMFFSVM 0x5C /* Read median filter FS value MSBs */ +#define NT35510_CMD_RDMFFSVL 0x5D /* Read median filter FS value LSBs */ +#define NT35510_CMD_WRCABCMB 0x5E /* Write CABC minimum brightness */ +#define NT35510_CMD_RDCABCMB 0x5F /* Read CABC minimum brightness */ +#define NT35510_CMD_WRLSCC 0x65 /* Write light sensor compensation coefficient value */ +#define NT35510_CMD_RDLSCCM 0x66 /* Read light sensor compensation coefficient value MSBs */ +#define NT35510_CMD_RDLSCCL 0x67 /* Read light sensor compensation coefficient value LSBs */ +#define NT35510_CMD_RDBWLB 0x70 /* Read black/white low bits */ +#define NT35510_CMD_RDBKX 0x71 /* Read Bkx */ +#define NT35510_CMD_RDBKY 0x72 /* Read Bky */ +#define NT35510_CMD_RDWX 0x73 /* Read Wx */ +#define NT35510_CMD_RDWY 0x74 /* Read Wy */ +#define NT35510_CMD_RDRGLB 0x75 /* Read red/green low bits */ +#define NT35510_CMD_RDRX 0x76 /* Read Rx */ +#define NT35510_CMD_RDRY 0x77 /* Read Ry */ +#define NT35510_CMD_RDGX 0x78 /* Read Gx */ +#define NT35510_CMD_RDGY 0x79 /* Read Gy */ +#define NT35510_CMD_RDBALB 0x7A /* Read blue/acolor low bits */ +#define NT35510_CMD_RDBX 0x7B /* Read Bx */ +#define NT35510_CMD_RDBY 0x7C /* Read By */ +#define NT35510_CMD_RDAX 0x7D /* Read Ax */ +#define NT35510_CMD_RDAY 0x7E /* Read Ay */ +#define NT35510_CMD_RDDDBS 0xA1 /* Read DDB start */ +#define NT35510_CMD_RDDDBC 0xA8 /* Read DDB continue */ +#define NT35510_CMD_RDDCS 0xAA /* Read first checksum */ +#define NT35510_CMD_RDCCS 0xAF /* Read continue checksum */ +#define NT35510_CMD_RDID1 0xDA /* Read ID1 value */ +#define NT35510_CMD_RDID2 0xDB /* Read ID2 value */ +#define NT35510_CMD_RDID3 0xDC /* Read ID3 value */ + +/* Parameter TELOM : Tearing Effect Line Output Mode : possible values */ +#define NT35510_TEEON_TELOM_VBLANKING_INFO_ONLY 0x00 +#define NT35510_TEEON_TELOM_VBLANKING_AND_HBLANKING_INFO 0x01 + +/* Possible used values of MADCTR */ +#define NT35510_MADCTR_MODE_PORTRAIT 0x00 +#define NT35510_MADCTR_MODE_LANDSCAPE 0x60 /* MY = 0, MX = 1, MV = 1, ML = 0, RGB = 0 */ + +/* Possible values of COLMOD parameter corresponding to used pixel formats */ +#define NT35510_COLMOD_RGB565 0x55 +#define NT35510_COLMOD_RGB888 0x77 + +/** + * @brief NT35510_480X800 frequency divider + */ +#define NT35510_480X800_FREQUENCY_DIVIDER 2 /* LCD Frequency divider */ + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ + +/** @defgroup NT35510_Exported_Macros NT35510 Exported Macros + * @{ + */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ + +/** @addtogroup NT35510_Exported_Functions + * @{ + */ +void DSI_IO_WriteCmd(uint32_t NbrParams, uint8_t *pParams); +uint8_t NT35510_Init(uint32_t ColorCoding, uint32_t orientation); +uint8_t NT35510_DeInit(void); +void NT35510_IO_Delay(uint32_t Delay); + +/** + * @} + */ +#ifdef __cplusplus +} +#endif + +#endif /* __NT35510_H */ +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/STM32469I-Discovery/stm32469i_discovery.c b/Drivers/BSP/STM32469I-Discovery/stm32469i_discovery.c index 7f275ec..b0bcfa6 100644 --- a/Drivers/BSP/STM32469I-Discovery/stm32469i_discovery.c +++ b/Drivers/BSP/STM32469I-Discovery/stm32469i_discovery.c @@ -152,6 +152,7 @@ uint16_t TS_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t void TS_IO_WriteMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length); void TS_IO_Delay(uint32_t Delay); void OTM8009A_IO_Delay(uint32_t Delay); +void NT35510_IO_Delay(uint32_t Delay); /** * @} */ @@ -914,6 +915,16 @@ void OTM8009A_IO_Delay(uint32_t Delay) HAL_Delay(Delay); } +/**************************** LINK NT35510 (Display driver) ******************/ +/** + * @brief NT35510 delay + * @param Delay: Delay in ms + */ +void NT35510_IO_Delay(uint32_t Delay) +{ + HAL_Delay(Delay); +} + /** * @} */ diff --git a/STM32CubeIDE/.project b/STM32CubeIDE/.project index 76b5146..f412fdd 100644 --- a/STM32CubeIDE/.project +++ b/STM32CubeIDE/.project @@ -249,6 +249,11 @@ 1 $%7BPARENT-1-PROJECT_LOC%7D/Drivers/BSP/Components/ft6x06/ft6x06.c + + Drivers/BSP/Components/nt35510.c + 1 + $%7BPARENT-1-PROJECT_LOC%7D/Drivers/BSP/Components/nt35510/nt35510.c + Drivers/BSP/Components/otm8009a.c 1 diff --git a/STM32F469I-DISCO.ioc b/STM32F469I-DISCO.ioc index 667542e..cc64d82 100644 --- a/STM32F469I-DISCO.ioc +++ b/STM32F469I-DISCO.ioc @@ -60,14 +60,16 @@ LTDC.Alpha_L0=255 LTDC.FBStartAdress_L0=0xC0000000 LTDC.HBP=1 LTDC.HFP=1 +LTDC.HSPolarity=LTDC_HSPOLARITY_AH LTDC.HSync=2 -LTDC.IPParameters=HSync,HBP,ActiveW,HFP,VSync,VBP,VFP,Layers,WindowX1_L0,WindowY1_L0,PixelFormat_L0,Alpha_L0,FBStartAdress_L0,ImageWidth_L0,ImageHeight_L0 +LTDC.IPParameters=HSync,HBP,ActiveW,HFP,VSync,VBP,VFP,Layers,WindowX1_L0,WindowY1_L0,PixelFormat_L0,Alpha_L0,FBStartAdress_L0,ImageWidth_L0,ImageHeight_L0,HSPolarity,VSPolarity LTDC.ImageHeight_L0=480 LTDC.ImageWidth_L0=200 LTDC.Layers=0 LTDC.PixelFormat_L0=LTDC_PIXEL_FORMAT_RGB565 LTDC.VBP=1 LTDC.VFP=1 +LTDC.VSPolarity=LTDC_VSPOLARITY_AH LTDC.VSync=2 LTDC.WindowX1_L0=200 LTDC.WindowY1_L0=480 @@ -179,26 +181,26 @@ Mcu.UserConstants= Mcu.UserName=STM32F469NIHx MxCube.Version=6.5.0 MxDb.Version=DB.6.0.50 -NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:true +NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.DMA2D_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true\:true NVIC.DSI_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true\:true -NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:true +NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.ForceEnableDMAVector=true -NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:true +NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.LTDC_IRQn=true\:5\:0\:true\:false\:true\:false\:true\:true\:true -NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:true -NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:true -NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:false\:true +NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false +NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false +NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:false\:false NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 -NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:true +NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:false NVIC.SavedPendsvIrqHandlerGenerated=true NVIC.SavedSvcallIrqHandlerGenerated=true NVIC.SavedSystickIrqHandlerGenerated=true -NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:true\:true +NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:true\:false NVIC.TIM6_DAC_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true\:true NVIC.TimeBase=TIM6_DAC_IRQn NVIC.TimeBaseIP=TIM6 -NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:true +NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false PA1.GPIOParameters=GPIO_Speed,GPIO_Label PA1.GPIO_Label=FRAME_RATE PA1.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH @@ -294,7 +296,7 @@ PH13.Signal=FMC_D21 PH14.Signal=FMC_D22 PH15.Signal=FMC_D23 PH7.GPIOParameters=GPIO_Speed,PinState,GPIO_ModeDefaultOutputPP -PH7.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD +PH7.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_PP PH7.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH PH7.Locked=true PH7.PinState=GPIO_PIN_RESET diff --git a/TouchGFX/assets/texts/texts.xml b/TouchGFX/assets/texts/texts.xml index fc6d9b6..54b295d 100644 --- a/TouchGFX/assets/texts/texts.xml +++ b/TouchGFX/assets/texts/texts.xml @@ -7,10 +7,10 @@ - OTM8009A + NT35510 - B-07 FRIDA FRD397B25009-D-CTK + B-08 FRIDA FRD400B25025-A-CTK STM32F469I Discovery diff --git a/TouchGFX/generated/texts/src/LanguageGb.cpp b/TouchGFX/generated/texts/src/LanguageGb.cpp deleted file mode 100644 index 234552f..0000000 --- a/TouchGFX/generated/texts/src/LanguageGb.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* DO NOT EDIT THIS FILE */ -/* This file is autogenerated by the text-database code generator */ - -#include -#include - -TEXT_LOCATION_FLASH_PRAGMA -KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE; - -// Remap all strings -TEXT_LOCATION_FLASH_PRAGMA -KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE = { - 51, // T___SINGLEUSE_HVFB: "OTM8009A" - 0, // T___SINGLEUSE_UF95: "B-07 FRIDA FRD397B25009-D-CTK" - 30 // T___SINGLEUSE_1IAY: "STM32F469I Discovery" -}; diff --git a/TouchGFX/generated/texts/src/Texts.cpp b/TouchGFX/generated/texts/src/Texts.cpp deleted file mode 100644 index b161ed7..0000000 --- a/TouchGFX/generated/texts/src/Texts.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* DO NOT EDIT THIS FILE */ -/* This file is autogenerated by the text-database code generator */ - -#include -#include -#include -#include -#include -#include -#include -#include - -uint16_t touchgfx::Font::getStringWidth(const touchgfx::Unicode::UnicodeChar* text, ...) const -{ - va_list pArg; - va_start(pArg, text); - uint16_t width = getStringWidthLTR(TEXT_DIRECTION_LTR, text, pArg); - va_end(pArg); - return width; -} - -uint16_t touchgfx::Font::getStringWidth(touchgfx::TextDirection textDirection, const touchgfx::Unicode::UnicodeChar* text, ...) const -{ - va_list pArg; - va_start(pArg, text); - uint16_t width = getStringWidthLTR(textDirection, text, pArg); - va_end(pArg); - return width; -} - -touchgfx::Unicode::UnicodeChar touchgfx::TextProvider::getNextLigature(TextDirection direction) -{ - if (fontGsubTable && nextCharacters.peekChar()) - { - substituteGlyphs(); - if (nextCharacters.peekChar(1) == 0x093F) // Hindi I-matra - { - nextCharacters.replaceAt1(nextCharacters.peekChar()); - nextCharacters.replaceAt0(0x093F); - } - } - return getNextChar(); -} - -void touchgfx::TextProvider::initializeInternal() -{ - fillInputBuffer(); -} - -void touchgfx::LCD::drawString(touchgfx::Rect widgetArea, const touchgfx::Rect& invalidatedArea, const touchgfx::LCD::StringVisuals& stringVisuals, const touchgfx::Unicode::UnicodeChar* format, ...) -{ - va_list pArg; - va_start(pArg, format); - drawStringLTR(widgetArea, invalidatedArea, stringVisuals, format, pArg); - va_end(pArg); -} - -// Default TypedTextDatabase -extern const touchgfx::TypedText::TypedTextData* const typedTextDatabaseArray[]; - -TEXT_LOCATION_FLASH_PRAGMA -KEEP extern const touchgfx::Unicode::UnicodeChar texts_all_languages[] TEXT_LOCATION_FLASH_ATTRIBUTE = { - 0x42, 0x2d, 0x30, 0x37, 0x20, 0x46, 0x52, 0x49, 0x44, 0x41, 0x20, 0x46, 0x52, 0x44, 0x33, 0x39, 0x37, 0x42, 0x32, 0x35, 0x30, 0x30, 0x39, 0x2d, 0x44, 0x2d, 0x43, 0x54, 0x4b, 0x0, // @0 "B-07 FRIDA FRD397B25009-D-CTK" - 0x53, 0x54, 0x4d, 0x33, 0x32, 0x46, 0x34, 0x36, 0x39, 0x49, 0x20, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x0, // @30 "STM32F469I Discovery" - 0x4f, 0x54, 0x4d, 0x38, 0x30, 0x30, 0x39, 0x41, 0x0 // @51 "OTM8009A" -}; - -TEXT_LOCATION_FLASH_PRAGMA -KEEP extern uint32_t const indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE; - -// Array holding dynamically installed languages -struct TranslationHeader -{ - uint32_t offset_to_texts; - uint32_t offset_to_indices; - uint32_t offset_to_typedtext; -}; -static const TranslationHeader* languagesArray[1] = { 0 }; - -// Compiled and linked in languages -static const uint32_t* const staticLanguageIndices[] = { - indicesGb -}; - -touchgfx::LanguageId touchgfx::Texts::currentLanguage = static_cast(0); -static const touchgfx::Unicode::UnicodeChar* currentLanguagePtr = 0; -static const uint32_t* currentLanguageIndices = 0; - -void touchgfx::Texts::setLanguage(touchgfx::LanguageId id) -{ - const touchgfx::TypedText::TypedTextData* currentLanguageTypedText = 0; - if (id < 1) - { - if (languagesArray[id] != 0) - { - // Dynamic translation is added - const TranslationHeader* translation = languagesArray[id]; - currentLanguagePtr = (const touchgfx::Unicode::UnicodeChar*)(((const uint8_t*)translation) + translation->offset_to_texts); - currentLanguageIndices = (const uint32_t*)(((const uint8_t*)translation) + translation->offset_to_indices); - currentLanguageTypedText = (const touchgfx::TypedText::TypedTextData*)(((const uint8_t*)translation) + translation->offset_to_typedtext); - } - else - { - // Compiled and linked in languages - currentLanguagePtr = texts_all_languages; - currentLanguageIndices = staticLanguageIndices[id]; - currentLanguageTypedText = typedTextDatabaseArray[id]; - } - } - - if (currentLanguageTypedText) - { - currentLanguage = id; - touchgfx::TypedText::registerTypedTextDatabase(currentLanguageTypedText, - TypedTextDatabase::getFonts(), TypedTextDatabase::getInstanceSize()); - } -} - -void touchgfx::Texts::setTranslation(touchgfx::LanguageId id, const void* translation) -{ - languagesArray[id] = (const TranslationHeader*)translation; -} - -const touchgfx::Unicode::UnicodeChar* touchgfx::Texts::getText(TypedTextId id) const -{ - return ¤tLanguagePtr[currentLanguageIndices[id]]; -} diff --git a/gcc/Makefile b/gcc/Makefile index f28a214..1913f50 100644 --- a/gcc/Makefile +++ b/gcc/Makefile @@ -225,6 +225,7 @@ board_c_files := \ $(Drivers_path)/BSP/STM32469I-Discovery/stm32469i_discovery_sdram.c \ $(Drivers_path)/BSP/STM32469I-Discovery/stm32469i_discovery_ts.c \ $(Drivers_path)/BSP/Components/ft6x06/ft6x06.c \ + $(Drivers_path)/BSP/Components/nt35510/nt35510.c \ $(Drivers_path)/BSP/Components/otm8009a/otm8009a.c board_cpp_files :=