st7789h2.h 5.2 KB

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