BSP driver for DISCO_L496AG

Dependents:   DISCO_L496AG-LCD-prova_1 DISCO_L496AG-LCD-prova_2 DISCO_L496AG-LCD-demo DISCO_L496AG-SRAM-demo

Committer:
Jerome Coutant
Date:
Wed Nov 20 16:48:24 2019 +0100
Revision:
2:106c7b82e064
Parent:
0:d83f1c8ca282
Update BSP files with CubeL4 V1.14.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:d83f1c8ca282 1 /**
bcostm 0:d83f1c8ca282 2 ******************************************************************************
bcostm 0:d83f1c8ca282 3 * @file st7789h2.h
bcostm 0:d83f1c8ca282 4 * @author MCD Application Team
bcostm 0:d83f1c8ca282 5 * @brief This file contains all the functions prototypes for the st7789h2.c
bcostm 0:d83f1c8ca282 6 * driver.
bcostm 0:d83f1c8ca282 7 ******************************************************************************
bcostm 0:d83f1c8ca282 8 * @attention
bcostm 0:d83f1c8ca282 9 *
Jerome Coutant 2:106c7b82e064 10 * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
Jerome Coutant 2:106c7b82e064 11 * All rights reserved.</center></h2>
bcostm 0:d83f1c8ca282 12 *
Jerome Coutant 2:106c7b82e064 13 * This software component is licensed by ST under BSD 3-Clause license,
Jerome Coutant 2:106c7b82e064 14 * the "License"; You may not use this file except in compliance with the
Jerome Coutant 2:106c7b82e064 15 * License. You may obtain a copy of the License at:
Jerome Coutant 2:106c7b82e064 16 * opensource.org/licenses/BSD-3-Clause
bcostm 0:d83f1c8ca282 17 *
bcostm 0:d83f1c8ca282 18 ******************************************************************************
bcostm 0:d83f1c8ca282 19 */
bcostm 0:d83f1c8ca282 20
bcostm 0:d83f1c8ca282 21 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 0:d83f1c8ca282 22 #ifndef __ST7789H2_H
bcostm 0:d83f1c8ca282 23 #define __ST7789H2_H
bcostm 0:d83f1c8ca282 24
bcostm 0:d83f1c8ca282 25 #ifdef __cplusplus
bcostm 0:d83f1c8ca282 26 extern "C" {
bcostm 0:d83f1c8ca282 27 #endif
bcostm 0:d83f1c8ca282 28
bcostm 0:d83f1c8ca282 29 /* Includes ------------------------------------------------------------------*/
bcostm 0:d83f1c8ca282 30 #include <stdio.h>
bcostm 0:d83f1c8ca282 31 #include "../Common/lcd.h"
bcostm 0:d83f1c8ca282 32
bcostm 0:d83f1c8ca282 33 /** @addtogroup BSP
bcostm 0:d83f1c8ca282 34 * @{
Jerome Coutant 2:106c7b82e064 35 */
bcostm 0:d83f1c8ca282 36
bcostm 0:d83f1c8ca282 37 /** @addtogroup Components
bcostm 0:d83f1c8ca282 38 * @{
bcostm 0:d83f1c8ca282 39 */
Jerome Coutant 2:106c7b82e064 40
bcostm 0:d83f1c8ca282 41 /** @addtogroup ST7789H2
bcostm 0:d83f1c8ca282 42 * @{
bcostm 0:d83f1c8ca282 43 */
bcostm 0:d83f1c8ca282 44
bcostm 0:d83f1c8ca282 45 /** @defgroup ST7789H2_Exported_Types ST7789H2 Exported Types
bcostm 0:d83f1c8ca282 46 * @{
Jerome Coutant 2:106c7b82e064 47 */
bcostm 0:d83f1c8ca282 48 /**
bcostm 0:d83f1c8ca282 49 * @}
Jerome Coutant 2:106c7b82e064 50 */
bcostm 0:d83f1c8ca282 51
bcostm 0:d83f1c8ca282 52 /** @defgroup ST7789H2_Exported_Constants ST7789H2 Exported Constants
bcostm 0:d83f1c8ca282 53 * @{
bcostm 0:d83f1c8ca282 54 */
Jerome Coutant 2:106c7b82e064 55 /**
bcostm 0:d83f1c8ca282 56 * @brief ST7789H2 ID
Jerome Coutant 2:106c7b82e064 57 */
bcostm 0:d83f1c8ca282 58 #define ST7789H2_ID 0x85
Jerome Coutant 2:106c7b82e064 59
bcostm 0:d83f1c8ca282 60 /**
bcostm 0:d83f1c8ca282 61 * @brief ST7789H2 Size
Jerome Coutant 2:106c7b82e064 62 */
bcostm 0:d83f1c8ca282 63 #define ST7789H2_LCD_PIXEL_WIDTH ((uint16_t)240)
bcostm 0:d83f1c8ca282 64 #define ST7789H2_LCD_PIXEL_HEIGHT ((uint16_t)240)
bcostm 0:d83f1c8ca282 65
bcostm 0:d83f1c8ca282 66 /**
bcostm 0:d83f1c8ca282 67 * @brief LCD_OrientationTypeDef
bcostm 0:d83f1c8ca282 68 * Possible values of Display Orientation
bcostm 0:d83f1c8ca282 69 */
bcostm 0:d83f1c8ca282 70 #define ST7789H2_ORIENTATION_PORTRAIT ((uint32_t)0x00) /* Portrait orientation choice of LCD screen */
bcostm 0:d83f1c8ca282 71 #define ST7789H2_ORIENTATION_LANDSCAPE ((uint32_t)0x01) /* Landscape orientation choice of LCD screen */
bcostm 0:d83f1c8ca282 72 #define ST7789H2_ORIENTATION_LANDSCAPE_ROT180 ((uint32_t)0x02) /* Landscape rotated 180° orientation choice of LCD screen */
Jerome Coutant 2:106c7b82e064 73
bcostm 0:d83f1c8ca282 74 /**
bcostm 0:d83f1c8ca282 75 * @brief ST7789H2 Registers
bcostm 0:d83f1c8ca282 76 */
Jerome Coutant 2:106c7b82e064 77 #define ST7789H2_LCD_ID 0x04
bcostm 0:d83f1c8ca282 78 #define ST7789H2_SLEEP_IN 0x10
bcostm 0:d83f1c8ca282 79 #define ST7789H2_SLEEP_OUT 0x11
Jerome Coutant 2:106c7b82e064 80 #define ST7789H2_PARTIAL_DISPLAY 0x12
bcostm 0:d83f1c8ca282 81 #define ST7789H2_DISPLAY_INVERSION 0x21
bcostm 0:d83f1c8ca282 82 #define ST7789H2_DISPLAY_ON 0x29
bcostm 0:d83f1c8ca282 83 #define ST7789H2_WRITE_RAM 0x2C
bcostm 0:d83f1c8ca282 84 #define ST7789H2_READ_RAM 0x2E
bcostm 0:d83f1c8ca282 85 #define ST7789H2_CASET 0x2A
bcostm 0:d83f1c8ca282 86 #define ST7789H2_RASET 0x2B
bcostm 0:d83f1c8ca282 87 #define ST7789H2_VSCRDEF 0x33 /* Vertical Scroll Definition */
bcostm 0:d83f1c8ca282 88 #define ST7789H2_VSCSAD 0x37 /* Vertical Scroll Start Address of RAM */
bcostm 0:d83f1c8ca282 89 #define ST7789H2_TEARING_EFFECT 0x35
bcostm 0:d83f1c8ca282 90 #define ST7789H2_NORMAL_DISPLAY 0x36
bcostm 0:d83f1c8ca282 91 #define ST7789H2_IDLE_MODE_OFF 0x38
bcostm 0:d83f1c8ca282 92 #define ST7789H2_IDLE_MODE_ON 0x39
bcostm 0:d83f1c8ca282 93 #define ST7789H2_COLOR_MODE 0x3A
Jerome Coutant 2:106c7b82e064 94 #define ST7789H2_WRCABCMB 0x5E /* Write Content Adaptive Brightness Control */
Jerome Coutant 2:106c7b82e064 95 #define ST7789H2_RDCABCMB 0x5F /* Read Content Adaptive Brightness Control */
bcostm 0:d83f1c8ca282 96 #define ST7789H2_PORCH_CTRL 0xB2
bcostm 0:d83f1c8ca282 97 #define ST7789H2_GATE_CTRL 0xB7
bcostm 0:d83f1c8ca282 98 #define ST7789H2_VCOM_SET 0xBB
Jerome Coutant 2:106c7b82e064 99 #define ST7789H2_DISPLAY_OFF 0xBD
bcostm 0:d83f1c8ca282 100 #define ST7789H2_LCM_CTRL 0xC0
bcostm 0:d83f1c8ca282 101 #define ST7789H2_VDV_VRH_EN 0xC2
Jerome Coutant 2:106c7b82e064 102 #define ST7789H2_VDV_SET 0xC4
bcostm 0:d83f1c8ca282 103 #define ST7789H2_VCOMH_OFFSET_SET 0xC5
bcostm 0:d83f1c8ca282 104 #define ST7789H2_FR_CTRL 0xC6
bcostm 0:d83f1c8ca282 105 #define ST7789H2_POWER_CTRL 0xD0
bcostm 0:d83f1c8ca282 106 #define ST7789H2_PV_GAMMA_CTRL 0xE0
Jerome Coutant 2:106c7b82e064 107 #define ST7789H2_NV_GAMMA_CTRL 0xE1
Jerome Coutant 2:106c7b82e064 108
bcostm 0:d83f1c8ca282 109 /**
bcostm 0:d83f1c8ca282 110 * @}
bcostm 0:d83f1c8ca282 111 */
Jerome Coutant 2:106c7b82e064 112
bcostm 0:d83f1c8ca282 113 /** @defgroup ST7789H2_Exported_Functions ST7789H2 Exported Functions
bcostm 0:d83f1c8ca282 114 * @{
bcostm 0:d83f1c8ca282 115 */
bcostm 0:d83f1c8ca282 116 void ST7789H2_Init(void);
Jerome Coutant 2:106c7b82e064 117 void ST7789H2_SetOrientation(uint32_t orientation);
bcostm 0:d83f1c8ca282 118 uint16_t ST7789H2_ReadID(void);
bcostm 0:d83f1c8ca282 119 void ST7789H2_WriteReg(uint8_t Command, uint8_t *Parameters, uint8_t NbParameters);
bcostm 0:d83f1c8ca282 120 uint8_t ST7789H2_ReadReg(uint8_t Command);
bcostm 0:d83f1c8ca282 121
bcostm 0:d83f1c8ca282 122 void ST7789H2_DisplayOn(void);
bcostm 0:d83f1c8ca282 123 void ST7789H2_DisplayOff(void);
bcostm 0:d83f1c8ca282 124 void ST7789H2_SetCursor(uint16_t Xpos, uint16_t Ypos);
bcostm 0:d83f1c8ca282 125 void ST7789H2_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
bcostm 0:d83f1c8ca282 126 uint16_t ST7789H2_ReadPixel(uint16_t Xpos, uint16_t Ypos);
bcostm 0:d83f1c8ca282 127
bcostm 0:d83f1c8ca282 128 void ST7789H2_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
bcostm 0:d83f1c8ca282 129 void ST7789H2_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
bcostm 0:d83f1c8ca282 130 void ST7789H2_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
bcostm 0:d83f1c8ca282 131 void ST7789H2_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata);
bcostm 0:d83f1c8ca282 132
bcostm 0:d83f1c8ca282 133 void ST7789H2_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
bcostm 0:d83f1c8ca282 134
bcostm 0:d83f1c8ca282 135
bcostm 0:d83f1c8ca282 136 uint16_t ST7789H2_GetLcdPixelWidth(void);
bcostm 0:d83f1c8ca282 137 uint16_t ST7789H2_GetLcdPixelHeight(void);
bcostm 0:d83f1c8ca282 138
bcostm 0:d83f1c8ca282 139 /* LCD driver structure */
bcostm 0:d83f1c8ca282 140 extern LCD_DrvTypeDef ST7789H2_drv;
bcostm 0:d83f1c8ca282 141
bcostm 0:d83f1c8ca282 142 /* LCD IO functions */
bcostm 0:d83f1c8ca282 143 extern void LCD_IO_Init(void);
bcostm 0:d83f1c8ca282 144 extern void LCD_IO_WriteMultipleData(uint16_t *pData, uint32_t Size);
bcostm 0:d83f1c8ca282 145 extern void LCD_IO_WriteReg(uint8_t Reg);
bcostm 0:d83f1c8ca282 146 extern void LCD_IO_WriteData(uint16_t RegValue);
bcostm 0:d83f1c8ca282 147 extern uint16_t LCD_IO_ReadData(void);
bcostm 0:d83f1c8ca282 148 extern void LCD_IO_Delay(uint32_t delay);
bcostm 0:d83f1c8ca282 149
bcostm 0:d83f1c8ca282 150 /**
bcostm 0:d83f1c8ca282 151 * @}
bcostm 0:d83f1c8ca282 152 */
Jerome Coutant 2:106c7b82e064 153
bcostm 0:d83f1c8ca282 154 #ifdef __cplusplus
bcostm 0:d83f1c8ca282 155 }
bcostm 0:d83f1c8ca282 156 #endif
bcostm 0:d83f1c8ca282 157
bcostm 0:d83f1c8ca282 158 #endif /* __ST7789H2_H */
bcostm 0:d83f1c8ca282 159
bcostm 0:d83f1c8ca282 160 /**
bcostm 0:d83f1c8ca282 161 * @}
bcostm 0:d83f1c8ca282 162 */
bcostm 0:d83f1c8ca282 163
bcostm 0:d83f1c8ca282 164 /**
bcostm 0:d83f1c8ca282 165 * @}
bcostm 0:d83f1c8ca282 166 */
bcostm 0:d83f1c8ca282 167
bcostm 0:d83f1c8ca282 168 /**
bcostm 0:d83f1c8ca282 169 * @}
bcostm 0:d83f1c8ca282 170 */
bcostm 0:d83f1c8ca282 171
bcostm 0:d83f1c8ca282 172 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/