stm3210b_eval_lcd.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm3210b_eval_lcd.h
00004   * @author  MCD Application Team
00005   * @version V4.3.0
00006   * @date    10/15/2010
00007   * @brief   This file contains all the functions prototypes for the stm3210b_eval_lcd
00008   *          firmware driver.
00009   ******************************************************************************
00010   * @copy
00011   *
00012   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00013   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00014   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00015   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00016   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00017   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00018   *
00019   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00020   */ 
00021 
00022 /* Define to prevent recursive inclusion -------------------------------------*/
00023 #ifndef __STM3210B_EVAL_LCD_H
00024 #define __STM3210B_EVAL_LCD_H
00025 
00026 #ifdef __cplusplus
00027  extern "C" {
00028 #endif
00029 
00030 /* Includes ------------------------------------------------------------------*/
00031 #include "stm32f10x.h"
00032 #include "../Common/fonts.h"
00033 
00034 /** @addtogroup Utilities
00035   * @{
00036   */
00037 
00038 /** @addtogroup STM32_EVAL
00039   * @{
00040   */ 
00041 
00042 /** @addtogroup STM3210B_EVAL
00043   * @{
00044   */
00045     
00046 /** @addtogroup STM3210B_EVAL_LCD
00047   * @{
00048   */ 
00049 
00050 
00051 /** @defgroup STM3210B_EVAL_LCD_Exported_Types
00052   * @{
00053   */
00054 typedef struct 
00055 {
00056   int16_t X;
00057   int16_t Y;
00058 } Point, * pPoint;   
00059 /**
00060   * @}
00061   */ 
00062 
00063 
00064 
00065 /** @defgroup STM3210B_EVAL_LCD_Exported_Constants
00066   * @{
00067   */ 
00068 
00069 /**
00070  * @brief Uncomment the line below if you want to use LCD_DrawBMP function to
00071  *        display a bitmap picture on the LCD. This function assumes that the bitmap
00072  *        file is loaded in the SPI Flash (mounted on STM3210B-EVAL board), however
00073  *        user can tailor it according to his application hardware requirement.     
00074  */
00075 /*#define USE_LCD_DrawBMP*/
00076 
00077 /**
00078  * @brief Uncomment the line below if you want to use user defined Delay function
00079  *        (for precise timing), otherwise default _delay_ function defined within
00080  *         this driver is used (less precise timing).  
00081  */
00082 /* #define USE_Delay */
00083 
00084 #ifdef USE_Delay
00085 #include "main.h"
00086  
00087   #define _delay_     Delay  /* !< User can provide more timing precise _delay_ function
00088                                    (with 10ms time base), using SysTick for example */
00089 #else
00090   #define _delay_     delay      /* !< Default _delay_ function with less precise timing */
00091 #endif                                     
00092 
00093 
00094 /** 
00095   * @brief  LCD Control pins  
00096   */ 
00097 #define LCD_NCS_PIN             GPIO_Pin_2                  
00098 #define LCD_NCS_GPIO_PORT       GPIOB                       
00099 #define LCD_NCS_GPIO_CLK        RCC_APB2Periph_GPIOB  
00100 #define LCD_NWR_PIN             GPIO_Pin_15
00101 #define LCD_NWR_GPIO_PORT       GPIOD
00102 #define LCD_NWR_GPIO_CLK        RCC_APB2Periph_GPIOD
00103 #define LCD_RS_PIN              GPIO_Pin_7                     
00104 #define LCD_RS_GPIO_PORT        GPIOD
00105 #define LCD_RS_GPIO_CLK         RCC_APB2Periph_GPIOD 
00106 
00107 /** 
00108   * @brief  LCD SPI Interface pins 
00109   */ 
00110 #define LCD_SPI                             SPI2
00111 #define LCD_SPI_CLK                       RCC_APB1Periph_SPI2
00112 #define LCD_SPI_SCK_PIN         GPIO_Pin_13                 
00113 #define LCD_SPI_SCK_GPIO_PORT   GPIOB                       
00114 #define LCD_SPI_SCK_GPIO_CLK    RCC_APB2Periph_GPIOB  
00115 #define LCD_SPI_MISO_PIN        GPIO_Pin_14                 
00116 #define LCD_SPI_MISO_GPIO_PORT  GPIOB                       
00117 #define LCD_SPI_MISO_GPIO_CLK   RCC_APB2Periph_GPIOB  
00118 #define LCD_SPI_MOSI_PIN        GPIO_Pin_15                 
00119 #define LCD_SPI_MOSI_GPIO_PORT  GPIOB                       
00120 #define LCD_SPI_MOSI_GPIO_CLK   RCC_APB2Periph_GPIOB 
00121 
00122 /** 
00123   * @brief  LCD Registers  
00124   */ 
00125 #define LCD_REG_0             0x00
00126 #define LCD_REG_1             0x01
00127 #define LCD_REG_2             0x02
00128 #define LCD_REG_3             0x03
00129 #define LCD_REG_4             0x04
00130 #define LCD_REG_5             0x05
00131 #define LCD_REG_6             0x06
00132 #define LCD_REG_7             0x07
00133 #define LCD_REG_8             0x08
00134 #define LCD_REG_9             0x09
00135 #define LCD_REG_10            0x0A
00136 #define LCD_REG_12            0x0C
00137 #define LCD_REG_13            0x0D
00138 #define LCD_REG_14            0x0E
00139 #define LCD_REG_15            0x0F
00140 #define LCD_REG_16            0x10
00141 #define LCD_REG_17            0x11
00142 #define LCD_REG_18            0x12
00143 #define LCD_REG_19            0x13
00144 #define LCD_REG_20            0x14
00145 #define LCD_REG_21            0x15
00146 #define LCD_REG_22            0x16
00147 #define LCD_REG_23            0x17
00148 #define LCD_REG_24            0x18
00149 #define LCD_REG_25            0x19
00150 #define LCD_REG_26            0x1A
00151 #define LCD_REG_27            0x1B
00152 #define LCD_REG_28            0x1C
00153 #define LCD_REG_29            0x1D
00154 #define LCD_REG_30            0x1E
00155 #define LCD_REG_31            0x1F
00156 #define LCD_REG_32            0x20
00157 #define LCD_REG_33            0x21
00158 #define LCD_REG_34            0x22
00159 #define LCD_REG_36            0x24
00160 #define LCD_REG_37            0x25
00161 #define LCD_REG_40            0x28
00162 #define LCD_REG_41            0x29
00163 #define LCD_REG_43            0x2B
00164 #define LCD_REG_45            0x2D
00165 #define LCD_REG_48            0x30
00166 #define LCD_REG_49            0x31
00167 #define LCD_REG_50            0x32
00168 #define LCD_REG_51            0x33
00169 #define LCD_REG_52            0x34
00170 #define LCD_REG_53            0x35
00171 #define LCD_REG_54            0x36
00172 #define LCD_REG_55            0x37
00173 #define LCD_REG_56            0x38
00174 #define LCD_REG_57            0x39
00175 #define LCD_REG_59            0x3B
00176 #define LCD_REG_60            0x3C
00177 #define LCD_REG_61            0x3D
00178 #define LCD_REG_62            0x3E
00179 #define LCD_REG_63            0x3F
00180 #define LCD_REG_64            0x40
00181 #define LCD_REG_65            0x41
00182 #define LCD_REG_66            0x42
00183 #define LCD_REG_67            0x43
00184 #define LCD_REG_68            0x44
00185 #define LCD_REG_69            0x45
00186 #define LCD_REG_70            0x46
00187 #define LCD_REG_71            0x47
00188 #define LCD_REG_72            0x48
00189 #define LCD_REG_73            0x49
00190 #define LCD_REG_74            0x4A
00191 #define LCD_REG_75            0x4B
00192 #define LCD_REG_76            0x4C
00193 #define LCD_REG_77            0x4D
00194 #define LCD_REG_78            0x4E
00195 #define LCD_REG_79            0x4F
00196 #define LCD_REG_80            0x50
00197 #define LCD_REG_81            0x51
00198 #define LCD_REG_82            0x52
00199 #define LCD_REG_83            0x53
00200 #define LCD_REG_96            0x60
00201 #define LCD_REG_97            0x61
00202 #define LCD_REG_106           0x6A
00203 #define LCD_REG_118           0x76
00204 #define LCD_REG_128           0x80
00205 #define LCD_REG_129           0x81
00206 #define LCD_REG_130           0x82
00207 #define LCD_REG_131           0x83
00208 #define LCD_REG_132           0x84
00209 #define LCD_REG_133           0x85
00210 #define LCD_REG_134           0x86
00211 #define LCD_REG_135           0x87
00212 #define LCD_REG_136           0x88
00213 #define LCD_REG_137           0x89
00214 #define LCD_REG_139           0x8B
00215 #define LCD_REG_140           0x8C
00216 #define LCD_REG_141           0x8D
00217 #define LCD_REG_143           0x8F
00218 #define LCD_REG_144           0x90
00219 #define LCD_REG_145           0x91
00220 #define LCD_REG_146           0x92
00221 #define LCD_REG_147           0x93
00222 #define LCD_REG_148           0x94
00223 #define LCD_REG_149           0x95
00224 #define LCD_REG_150           0x96
00225 #define LCD_REG_151           0x97
00226 #define LCD_REG_152           0x98
00227 #define LCD_REG_153           0x99
00228 #define LCD_REG_154           0x9A
00229 #define LCD_REG_157           0x9D
00230 #define LCD_REG_192           0xC0
00231 #define LCD_REG_193           0xC1
00232 #define LCD_REG_227           0xE3
00233 #define LCD_REG_229           0xE5
00234 #define LCD_REG_231           0xE7
00235 #define LCD_REG_239           0xEF
00236 
00237 
00238 /** 
00239   * @brief  LCD color  
00240   */ 
00241 #define LCD_COLOR_WHITE          0xFFFF
00242 #define LCD_COLOR_BLACK          0x0000
00243 #define LCD_COLOR_GREY           0xF7DE
00244 #define LCD_COLOR_BLUE           0x001F
00245 #define LCD_COLOR_BLUE2          0x051F
00246 #define LCD_COLOR_RED            0xF800
00247 #define LCD_COLOR_MAGENTA        0xF81F
00248 #define LCD_COLOR_GREEN          0x07E0
00249 #define LCD_COLOR_CYAN           0x7FFF
00250 #define LCD_COLOR_YELLOW         0xFFE0
00251 
00252 /** 
00253   * @brief  LCD Lines depending on the chosen fonts.  
00254   */
00255 #define LCD_LINE_0               LINE(0)
00256 #define LCD_LINE_1               LINE(1)
00257 #define LCD_LINE_2               LINE(2)
00258 #define LCD_LINE_3               LINE(3)
00259 #define LCD_LINE_4               LINE(4)
00260 #define LCD_LINE_5               LINE(5)
00261 #define LCD_LINE_6               LINE(6)
00262 #define LCD_LINE_7               LINE(7)
00263 #define LCD_LINE_8               LINE(8)
00264 #define LCD_LINE_9               LINE(9)
00265 #define LCD_LINE_10              LINE(10)
00266 #define LCD_LINE_11              LINE(11)
00267 #define LCD_LINE_12              LINE(12)
00268 #define LCD_LINE_13              LINE(13)
00269 #define LCD_LINE_14              LINE(14)
00270 #define LCD_LINE_15              LINE(15)
00271 #define LCD_LINE_16              LINE(16)
00272 #define LCD_LINE_17              LINE(17)
00273 #define LCD_LINE_18              LINE(18)
00274 #define LCD_LINE_19              LINE(19)
00275 #define LCD_LINE_20              LINE(20)
00276 #define LCD_LINE_21              LINE(21)
00277 #define LCD_LINE_22              LINE(22)
00278 #define LCD_LINE_23              LINE(23)
00279 #define LCD_LINE_24              LINE(24)
00280 #define LCD_LINE_25              LINE(25)
00281 #define LCD_LINE_26              LINE(26)
00282 #define LCD_LINE_27              LINE(27)
00283 #define LCD_LINE_28              LINE(28)
00284 #define LCD_LINE_29              LINE(29)
00285 
00286 /** 
00287   * @brief LCD default font 
00288   */ 
00289 #define LCD_DEFAULT_FONT         Font16x24
00290 
00291 /** 
00292   * @brief  LCD Direction  
00293   */ 
00294 #define LCD_DIR_HORIZONTAL       0x0000
00295 #define LCD_DIR_VERTICAL         0x0001
00296 
00297 /** 
00298   * @brief  LCD Size (Width and Height)  
00299   */ 
00300 #define LCD_PIXEL_WIDTH          0x0140
00301 #define LCD_PIXEL_HEIGHT         0x00F0
00302 
00303 /**
00304   * @}
00305   */ 
00306 
00307 /** @defgroup STM3210B_EVAL_LCD_Exported_Macros
00308   * @{
00309   */
00310 #define ASSEMBLE_RGB(R, G, B)    ((((R)& 0xF8) << 8) | (((G) & 0xFC) << 3) | (((B) & 0xF8) >> 3))   
00311 /**
00312   * @}
00313   */ 
00314 
00315 
00316 
00317 /** @defgroup STM3210B_EVAL_LCD_Exported_Functions
00318   * @{
00319   */ 
00320 void LCD_DeInit(void);
00321 void LCD_Setup(void);
00322 void STM3210B_LCD_Init(void);
00323 void LCD_SetColors(__IO uint16_t _TextColor, __IO uint16_t _BackColor); 
00324 void LCD_GetColors(__IO uint16_t *_TextColor, __IO uint16_t *_BackColor); 
00325 void LCD_SetTextColor(__IO uint16_t Color);
00326 void LCD_SetBackColor(__IO uint16_t Color);
00327 void LCD_ClearLine(uint8_t Line);
00328 void LCD_Clear(uint16_t Color);
00329 void LCD_SetCursor(uint8_t Xpos, uint16_t Ypos);
00330 void LCD_DrawChar(uint8_t Xpos, uint16_t Ypos, const uint16_t *c);
00331 void LCD_DisplayChar(uint8_t Line, uint16_t Column, uint8_t Ascii);
00332 void LCD_SetFont(sFONT *fonts);
00333 sFONT *LCD_GetFont(void);
00334 void LCD_DisplayStringLine(uint8_t Line, uint8_t *ptr);
00335 void LCD_SetDisplayWindow(uint8_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width);
00336 void LCD_WindowModeDisable(void);
00337 void LCD_DrawLine(uint8_t Xpos, uint16_t Ypos, uint16_t Length, uint8_t Direction);
00338 void LCD_DrawRect(uint8_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width);
00339 void LCD_DrawCircle(uint8_t Xpos, uint16_t Ypos, uint16_t Radius);
00340 void LCD_DrawMonoPict(const uint32_t *Pict);
00341 void LCD_DrawBMP(uint32_t BmpAddress);
00342 void LCD_DrawUniLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
00343 void LCD_DrawFullRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00344 void LCD_DrawFullCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
00345 void LCD_PolyLine(pPoint Points, uint16_t PointCount);
00346 void LCD_PolyLineRelative(pPoint Points, uint16_t PointCount);
00347 void LCD_ClosedPolyLine(pPoint Points, uint16_t PointCount);
00348 void LCD_ClosedPolyLineRelative(pPoint Points, uint16_t PointCount);
00349 void LCD_FillPolyLine(pPoint Points, uint16_t PointCount);
00350 
00351 void LCD_nCS_StartByte(uint8_t Start_Byte);
00352 void LCD_WriteRegIndex(uint8_t LCD_Reg);
00353 void LCD_WriteReg(uint8_t LCD_Reg, uint16_t LCD_RegValue);
00354 void LCD_WriteRAM_Prepare(void);
00355 void LCD_WriteRAMWord(uint16_t RGB_Code);
00356 uint16_t LCD_ReadReg(uint8_t LCD_Reg);
00357 void LCD_WriteRAM(uint16_t RGB_Code);
00358 void LCD_PowerOn(void);
00359 void LCD_DisplayOn(void);
00360 void LCD_DisplayOff(void);
00361 
00362 void LCD_CtrlLinesConfig(void);
00363 void LCD_CtrlLinesWrite(GPIO_TypeDef* GPIOx, uint16_t CtrlPins, BitAction BitVal);
00364 void LCD_SPIConfig(void);
00365 
00366 /**
00367   * @}
00368   */ 
00369   
00370 #ifdef __cplusplus
00371 }
00372 #endif
00373 
00374 #endif /* __STM3210B_EVAL_LCD_H */
00375 
00376 
00377 /**
00378   * @}
00379   */ 
00380 
00381 /**
00382   * @}
00383   */ 
00384 
00385 /**
00386   * @}
00387   */ 
00388 
00389 /**
00390   * @}
00391   */   
00392   
00393 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32