stm322xg_eval_lcd.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /**
  2. ******************************************************************************
  3. * @file stm322xg_eval_lcd.h
  4. * @author MCD Application Team
  5. * @brief This file contains the common defines and functions prototypes for
  6. * the stm322xg_eval_lcd.c driver.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  11. *
  12. * Redistribution and use in source and binary forms, with or without modification,
  13. * are permitted provided that the following conditions are met:
  14. * 1. Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * 2. Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  20. * may be used to endorse or promote products derived from this software
  21. * without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  27. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  29. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  30. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  31. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. ******************************************************************************
  35. */
  36. /* Define to prevent recursive inclusion -------------------------------------*/
  37. #ifndef __STM322XG_EVAL_LCD_H
  38. #define __STM322XG_EVAL_LCD_H
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. /* Includes ------------------------------------------------------------------*/
  43. #include "stm322xg_eval.h"
  44. #include "../Components/ili9325/ili9325.h"
  45. #include "../Components/ili9320/ili9320.h"
  46. #include "../../../Utilities/Fonts/fonts.h"
  47. /** @addtogroup BSP
  48. * @{
  49. */
  50. /** @addtogroup STM322xG_EVAL
  51. * @{
  52. */
  53. /** @addtogroup STM322xG_EVAL_LCD
  54. * @{
  55. */
  56. /** @defgroup STM322xG_EVAL_LCD_Exported_Types STM322xG EVAL LCD Exported Types
  57. * @{
  58. */
  59. typedef struct
  60. {
  61. uint32_t TextColor;
  62. uint32_t BackColor;
  63. sFONT *pFont;
  64. }LCD_DrawPropTypeDef;
  65. /**
  66. * @}
  67. */
  68. /** @defgroup STM322xG_EVAL_LCD_Exported_Constants STM322xG EVAL LCD Exported Constants
  69. * @{
  70. */
  71. /**
  72. * @brief LCD status structure definition
  73. */
  74. #define LCD_OK 0x00
  75. #define LCD_ERROR 0x01
  76. #define LCD_TIMEOUT 0x02
  77. typedef struct
  78. {
  79. int16_t X;
  80. int16_t Y;
  81. }Point, * pPoint;
  82. /**
  83. * @brief Line mode structures definition
  84. */
  85. typedef enum
  86. {
  87. CENTER_MODE = 0x01, /* Center mode */
  88. RIGHT_MODE = 0x02, /* Right mode */
  89. LEFT_MODE = 0x03 /* Left mode */
  90. }Line_ModeTypdef;
  91. /**
  92. * @brief LCD color
  93. */
  94. #define LCD_COLOR_BLUE 0x001F
  95. #define LCD_COLOR_GREEN 0x07E0
  96. #define LCD_COLOR_RED 0xF800
  97. #define LCD_COLOR_CYAN 0x07FF
  98. #define LCD_COLOR_MAGENTA 0xF81F
  99. #define LCD_COLOR_YELLOW 0xFFE0
  100. #define LCD_COLOR_LIGHTBLUE 0x841F
  101. #define LCD_COLOR_LIGHTGREEN 0x87F0
  102. #define LCD_COLOR_LIGHTRED 0xFC10
  103. #define LCD_COLOR_LIGHTCYAN 0x87FF
  104. #define LCD_COLOR_LIGHTMAGENTA 0xFC1F
  105. #define LCD_COLOR_LIGHTYELLOW 0xFFF0
  106. #define LCD_COLOR_DARKBLUE 0x0010
  107. #define LCD_COLOR_DARKGREEN 0x0400
  108. #define LCD_COLOR_DARKRED 0x8000
  109. #define LCD_COLOR_DARKCYAN 0x0410
  110. #define LCD_COLOR_DARKMAGENTA 0x8010
  111. #define LCD_COLOR_DARKYELLOW 0x8400
  112. #define LCD_COLOR_WHITE 0xFFFF
  113. #define LCD_COLOR_LIGHTGRAY 0xD69A
  114. #define LCD_COLOR_GRAY 0x8410
  115. #define LCD_COLOR_DARKGRAY 0x4208
  116. #define LCD_COLOR_BLACK 0x0000
  117. #define LCD_COLOR_BROWN 0xA145
  118. #define LCD_COLOR_ORANGE 0xFD20
  119. /**
  120. * @brief LCD default font
  121. */
  122. #define LCD_DEFAULT_FONT Font24
  123. /**
  124. * @}
  125. */
  126. /** @defgroup STM322xG_EVAL_LCD_Exported_Functions STM322xG EVAL LCD Exported Functions
  127. * @{
  128. */
  129. uint8_t BSP_LCD_Init(void);
  130. uint32_t BSP_LCD_GetXSize(void);
  131. uint32_t BSP_LCD_GetYSize(void);
  132. uint16_t BSP_LCD_GetTextColor(void);
  133. uint16_t BSP_LCD_GetBackColor(void);
  134. void BSP_LCD_SetTextColor(__IO uint16_t Color);
  135. void BSP_LCD_SetBackColor(__IO uint16_t Color);
  136. void BSP_LCD_SetFont(sFONT *fonts);
  137. sFONT *BSP_LCD_GetFont(void);
  138. void BSP_LCD_Clear(uint16_t Color);
  139. void BSP_LCD_ClearStringLine(uint16_t Line);
  140. void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
  141. void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Line_ModeTypdef Mode);
  142. void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
  143. uint16_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos);
  144. void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code);
  145. void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
  146. void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
  147. void BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
  148. void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
  149. void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
  150. void BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
  151. void BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
  152. void BSP_LCD_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
  153. void BSP_LCD_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pbmp);
  154. void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
  155. void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
  156. void BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
  157. void BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
  158. void BSP_LCD_DisplayOff(void);
  159. void BSP_LCD_DisplayOn(void);
  160. /**
  161. * @}
  162. */
  163. /**
  164. * @}
  165. */
  166. /**
  167. * @}
  168. */
  169. /**
  170. * @}
  171. */
  172. #ifdef __cplusplus
  173. }
  174. #endif
  175. #endif /* __STM322XG_EVAL_LCD_H */
  176. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/