stm32_adafruit_lcd.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /**
  2. ******************************************************************************
  3. * @file stm32_adafruit_lcd.h
  4. * @author MCD Application Team
  5. * @brief This file contains the common defines and functions prototypes for
  6. * the stm32_adafruit_lcd.c driver.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM32_ADAFRUIT_LCD_H
  38. #define __STM32_ADAFRUIT_LCD_H
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. /* Includes ------------------------------------------------------------------*/
  43. #include "../Components/st7735/st7735.h"
  44. #include "../../../Utilities/Fonts/fonts.h"
  45. /** @addtogroup BSP
  46. * @{
  47. */
  48. /** @addtogroup STM32_ADAFRUIT
  49. * @{
  50. */
  51. /** @addtogroup STM32_ADAFRUIT_LCD
  52. * @{
  53. */
  54. /** @defgroup STM32_ADAFRUIT_LCD_Exported_Types
  55. * @{
  56. */
  57. /**
  58. * @brief Draw Properties structures definition
  59. */
  60. typedef struct
  61. {
  62. uint32_t TextColor;
  63. uint32_t BackColor;
  64. sFONT *pFont;
  65. }LCD_DrawPropTypeDef;
  66. /**
  67. * @brief Point structures definition
  68. */
  69. typedef struct
  70. {
  71. int16_t X;
  72. int16_t Y;
  73. }Point, * pPoint;
  74. /**
  75. * @brief Line mode structures definition
  76. */
  77. typedef enum
  78. {
  79. CENTER_MODE = 0x01, /*!< Center mode */
  80. RIGHT_MODE = 0x02, /*!< Right mode */
  81. LEFT_MODE = 0x03 /*!< Left mode */
  82. }Line_ModeTypdef;
  83. /**
  84. * @}
  85. */
  86. /** @defgroup STM32_ADAFRUIT_LCD_Exported_Constants
  87. * @{
  88. */
  89. #define __IO volatile
  90. /**
  91. * @brief LCD status structure definition
  92. */
  93. #define LCD_OK 0x00
  94. #define LCD_ERROR 0x01
  95. #define LCD_TIMEOUT 0x02
  96. /**
  97. * @brief LCD color
  98. */
  99. #define LCD_COLOR_BLACK 0x0000
  100. #define LCD_COLOR_GREY 0xF7DE
  101. #define LCD_COLOR_BLUE 0x001F
  102. #define LCD_COLOR_RED 0xF800
  103. #define LCD_COLOR_GREEN 0x07E0
  104. #define LCD_COLOR_CYAN 0x07FF
  105. #define LCD_COLOR_MAGENTA 0xF81F
  106. #define LCD_COLOR_YELLOW 0xFFE0
  107. #define LCD_COLOR_WHITE 0xFFFF
  108. /**
  109. * @brief LCD default font
  110. */
  111. #define LCD_DEFAULT_FONT Font8
  112. /**
  113. * @}
  114. */
  115. /** @defgroup STM32_ADAFRUIT_LCD_Exported_Functions
  116. * @{
  117. */
  118. uint8_t BSP_LCD_Init(void);
  119. uint32_t BSP_LCD_GetXSize(void);
  120. uint32_t BSP_LCD_GetYSize(void);
  121. uint16_t BSP_LCD_GetTextColor(void);
  122. uint16_t BSP_LCD_GetBackColor(void);
  123. void BSP_LCD_SetTextColor(__IO uint16_t Color);
  124. void BSP_LCD_SetBackColor(__IO uint16_t Color);
  125. void BSP_LCD_SetFont(sFONT *fonts);
  126. sFONT *BSP_LCD_GetFont(void);
  127. void BSP_LCD_Clear(uint16_t Color);
  128. void BSP_LCD_ClearStringLine(uint16_t Line);
  129. void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
  130. void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Line_ModeTypdef Mode);
  131. void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
  132. void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code);
  133. void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
  134. void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
  135. void BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
  136. void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
  137. void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
  138. void BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
  139. void BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
  140. void BSP_LCD_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pBmp);
  141. void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
  142. void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
  143. void BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
  144. void BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
  145. void BSP_LCD_DisplayOff(void);
  146. void BSP_LCD_DisplayOn(void);
  147. /**
  148. * @}
  149. */
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153. #endif /* __STM32_ADAFRUIT_LCD_H */
  154. /**
  155. * @}
  156. */
  157. /**
  158. * @}
  159. */
  160. /**
  161. * @}
  162. */
  163. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/