stm3210c_eval_lcd.h

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