WILLY BAYOT / stm32_adafruit

Dependents:   TDEMNucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32_adafruit_lcd.h Source File

stm32_adafruit_lcd.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32_adafruit_lcd.h
00004   * @author  MCD Application Team
00005   * @version V1.0.0
00006   * @date    22-April-2014
00007   * @brief   This file contains the common defines and functions prototypes for
00008   *          the stm32_adafruit_lcd.c driver.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
00013   *
00014   * Redistribution and use in source and binary forms, with or without modification,
00015   * are permitted provided that the following conditions are met:
00016   *   1. Redistributions of source code must retain the above copyright notice,
00017   *      this list of conditions and the following disclaimer.
00018   *   2. Redistributions in binary form must reproduce the above copyright notice,
00019   *      this list of conditions and the following disclaimer in the documentation
00020   *      and/or other materials provided with the distribution.
00021   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00022   *      may be used to endorse or promote products derived from this software
00023   *      without specific prior written permission.
00024   *
00025   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00026   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00028   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00029   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00030   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00031   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00033   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00034   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035   *
00036   ******************************************************************************
00037   */ 
00038 
00039 /* Define to prevent recursive inclusion -------------------------------------*/
00040 #ifndef __STM32_ADAFRUIT_LCD_H
00041 #define __STM32_ADAFRUIT_LCD_H
00042 
00043 #ifdef __cplusplus
00044  extern "C" {
00045 #endif 
00046 
00047 /* Includes ------------------------------------------------------------------*/
00048 #include "st7735.h"
00049 #include "fonts.h"
00050 
00051 /** @addtogroup BSP
00052   * @{
00053   */
00054 
00055 /** @addtogroup STM32_ADAFRUIT
00056   * @{
00057   */
00058 #define __IO    volatile   
00059 /** @addtogroup STM32_ADAFRUIT_LCD
00060   * @{
00061   */ 
00062 
00063 
00064 /** @defgroup STM32_ADAFRUIT_LCD_Exported_Types
00065   * @{
00066   */
00067    
00068 /** 
00069   * @brief  Draw Properties structures definition
00070   */ 
00071 typedef struct 
00072 { 
00073   uint32_t TextColor;
00074   uint32_t BackColor;
00075   sFONT    *pFont; 
00076 
00077 }LCD_DrawPropTypeDef;
00078 
00079 /** 
00080   * @brief  Point structures definition
00081   */ 
00082 typedef struct 
00083 {
00084   int16_t X;
00085   int16_t Y;
00086 
00087 }Point, * pPoint;
00088 
00089 /** 
00090   * @brief  Line mode structures definition
00091   */ 
00092 typedef enum
00093 {
00094   CENTER_MODE             = 0x01,    /*!< Center mode */
00095   RIGHT_MODE              = 0x02,    /*!< Right mode  */
00096   LEFT_MODE               = 0x03     /*!< Left mode   */
00097 
00098 }Line_ModeTypdef;
00099 
00100 /**
00101   * @}
00102   */ 
00103 
00104 /** @defgroup STM32_ADAFRUIT_LCD_Exported_Constants
00105   * @{
00106   */
00107 /** 
00108   * @brief  LCD status structure definition  
00109   */     
00110 #define LCD_OK         0x00
00111 #define LCD_ERROR      0x01
00112 #define LCD_TIMEOUT    0x02
00113 
00114 /** 
00115   * @brief  LCD color  
00116   */
00117 #define LCD_COLOR_BLACK         0x0000
00118 #define LCD_COLOR_GREY          0xF7DE          
00119 #define LCD_COLOR_BLUE          0x001F
00120 #define LCD_COLOR_RED           0xF800
00121 #define LCD_COLOR_GREEN         0x07E0
00122 #define LCD_COLOR_CYAN          0x07FF
00123 #define LCD_COLOR_MAGENTA       0xF81F
00124 #define LCD_COLOR_YELLOW        0xFFE0
00125 #define LCD_COLOR_WHITE         0xFFFF
00126 
00127 /** 
00128   * @brief LCD default font 
00129   */ 
00130 #define LCD_DEFAULT_FONT         Font8
00131 
00132 /**
00133   * @}
00134   */
00135 
00136 /** @defgroup STM32_ADAFRUIT_LCD_Exported_Functions
00137   * @{
00138   */   
00139 uint8_t  BSP_LCD_Init(void);
00140 uint32_t BSP_LCD_GetXSize(void);
00141 uint32_t BSP_LCD_GetYSize(void);
00142  
00143 uint16_t BSP_LCD_GetTextColor(void);
00144 uint16_t BSP_LCD_GetBackColor(void);
00145 void     BSP_LCD_SetTextColor(__IO uint16_t Color);
00146 void     BSP_LCD_SetBackColor(__IO uint16_t Color);
00147 void     BSP_LCD_SetFont(sFONT *fonts);
00148 sFONT    *BSP_LCD_GetFont(void);
00149 
00150 void     BSP_LCD_Clear(uint16_t Color);
00151 void     BSP_LCD_ClearStringLine(uint16_t Line);
00152 void     BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
00153 void     BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Line_ModeTypdef Mode);
00154 void     BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
00155 
00156 void     BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code);
00157 void     BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
00158 void     BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
00159 void     BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
00160 void     BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00161 void     BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
00162 void     BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
00163 void     BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
00164 void     BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00165 void     BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
00166 void     BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
00167 void     BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
00168 
00169 void     BSP_LCD_DisplayOff(void);
00170 void     BSP_LCD_DisplayOn(void);
00171 
00172 /**
00173   * @}
00174   */
00175   
00176 #ifdef __cplusplus
00177 }
00178 #endif
00179 
00180 #endif /* __STM32_ADAFRUIT_LCD_H */
00181 /**
00182   * @}
00183   */ 
00184 
00185 /**
00186   * @}
00187   */ 
00188 
00189 /**
00190   * @}
00191   */ 
00192 
00193 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/