2 ******************************************************************************
\r
3 * @file stm32l_discovery_lcd.c
\r
4 * @author Microcontroller Division
\r
7 * @brief This file includes driver for the glass LCD Module mounted on
\r
8 * STM32l discovery board MB963
\r
9 ******************************************************************************
\r
12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
\r
13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
\r
14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
\r
15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
\r
16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
\r
17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
19 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
\r
22 /* Includes ------------------------------------------------------------------*/
\r
23 #include "stm32l_discovery_lcd.h"
\r
24 #include "discover_board.h"
\r
25 #include "stm32l1xx_lcd.h"
\r
28 /* this variable can be used for accelerate the scrolling exit when push user button */
\r
29 volatile bool KeyPressed = FALSE;
\r
31 /* LCD BAR status: We don't write directly in LCD RAM for save the bar setting */
\r
32 uint8_t t_bar[2]={0x0,0X0};
\r
34 /* =========================================================================
\r
36 =========================================================================
\r
49 An LCD character coding is based on the following matrix:
\r
55 The character 'A' for example is:
\r
56 -------------------------------
\r
57 LSB { 1 , 0 , 0 , 0 }
\r
60 MSB { 1 , 1 , 0 , 0 }
\r
66 /* Constant table for cap characters 'A' --> 'Z' */
\r
67 const uint16_t CapLetterMap[26]=
\r
69 /* A B C D E F G H I */
\r
70 0xFE00,0x6714,0x1d00,0x4714,0x9d00,0x9c00,0x3f00,0xfa00,0x0014,
\r
71 /* J K L M N O P Q R */
\r
72 0x5300,0x9841,0x1900,0x5a48,0x5a09,0x5f00,0xFC00,0x5F01,0xFC01,
\r
73 /* S T U V W X Y Z */
\r
74 0xAF00,0x0414,0x5b00,0x18c0,0x5a81,0x00c9,0x0058,0x05c0
\r
77 /* Constant table for number '0' --> '9' */
\r
78 const uint16_t NumberMap[10]=
\r
80 /* 0 1 2 3 4 5 6 7 8 9 */
\r
81 0x5F00,0x4200,0xF500,0x6700,0xEa00,0xAF00,0xBF00,0x04600,0xFF00,0xEF00
\r
84 static void LCD_Conv_Char_Seg(uint8_t* c,bool point,bool column,uint8_t* digit);
\r
87 * @brief Configures the LCD GLASS relative GPIO port IOs and LCD peripheral.
\r
91 void LCD_GLASS_Init(void)
\r
93 LCD_InitTypeDef LCD_InitStruct;
\r
96 LCD_InitStruct.LCD_Prescaler = LCD_Prescaler_1;
\r
97 LCD_InitStruct.LCD_Divider = LCD_Divider_31;
\r
98 LCD_InitStruct.LCD_Duty = LCD_Duty_1_4;
\r
99 LCD_InitStruct.LCD_Bias = LCD_Bias_1_3;
\r
100 LCD_InitStruct.LCD_VoltageSource = LCD_VoltageSource_Internal;
\r
103 /* Initialize the LCD */
\r
104 LCD_Init(&LCD_InitStruct);
\r
106 LCD_MuxSegmentCmd(ENABLE);
\r
108 /* To set contrast to mean value */
\r
109 LCD_ContrastConfig(LCD_Contrast_Level_4);
\r
111 LCD_DeadTimeConfig(LCD_DeadTime_0);
\r
112 LCD_PulseOnDurationConfig(LCD_PulseOnDuration_4);
\r
114 /* Wait Until the LCD FCR register is synchronized */
\r
115 LCD_WaitForSynchro();
\r
117 /* Enable LCD peripheral */
\r
120 /* Wait Until the LCD is enabled */
\r
121 while(LCD_GetFlagStatus(LCD_FLAG_ENS) == RESET)
\r
124 /*!< Wait Until the LCD Booster is ready */
\r
125 while(LCD_GetFlagStatus(LCD_FLAG_RDY) == RESET)
\r
129 LCD_BlinkConfig(LCD_BlinkMode_Off,LCD_BlinkFrequency_Div32);
\r
134 * @brief To initialize the LCD pins
\r
140 void LCD_GLASS_Configure_GPIO(void)
\r
142 GPIO_InitTypeDef GPIO_InitStructure;
\r
144 /* Enable GPIOs clock */
\r
145 RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |
\r
146 RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH, ENABLE);
\r
149 /* Configure Output for LCD */
\r
151 GPIO_StructInit(&GPIO_InitStructure);
\r
152 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_8 | GPIO_Pin_9 |GPIO_Pin_10 |GPIO_Pin_15;
\r
153 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
\r
154 GPIO_Init( GPIOA, &GPIO_InitStructure);
\r
156 GPIO_PinAFConfig(GPIOA, GPIO_PinSource1,GPIO_AF_LCD) ;
\r
157 GPIO_PinAFConfig(GPIOA, GPIO_PinSource2,GPIO_AF_LCD) ;
\r
158 GPIO_PinAFConfig(GPIOA, GPIO_PinSource3,GPIO_AF_LCD) ;
\r
159 GPIO_PinAFConfig(GPIOA, GPIO_PinSource8,GPIO_AF_LCD) ;
\r
160 GPIO_PinAFConfig(GPIOA, GPIO_PinSource9,GPIO_AF_LCD) ;
\r
161 GPIO_PinAFConfig(GPIOA, GPIO_PinSource10,GPIO_AF_LCD) ;
\r
162 GPIO_PinAFConfig(GPIOA, GPIO_PinSource15,GPIO_AF_LCD) ;
\r
164 /* Configure Output for LCD */
\r
166 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_9 \
\r
167 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
\r
168 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
\r
169 GPIO_Init( GPIOB, &GPIO_InitStructure);
\r
171 GPIO_PinAFConfig(GPIOB, GPIO_PinSource3,GPIO_AF_LCD) ;
\r
172 GPIO_PinAFConfig(GPIOB, GPIO_PinSource4,GPIO_AF_LCD) ;
\r
173 GPIO_PinAFConfig(GPIOB, GPIO_PinSource5,GPIO_AF_LCD) ;
\r
174 GPIO_PinAFConfig(GPIOB, GPIO_PinSource8,GPIO_AF_LCD) ;
\r
175 GPIO_PinAFConfig(GPIOB, GPIO_PinSource9,GPIO_AF_LCD) ;
\r
176 GPIO_PinAFConfig(GPIOB, GPIO_PinSource10,GPIO_AF_LCD) ;
\r
177 GPIO_PinAFConfig(GPIOB, GPIO_PinSource11,GPIO_AF_LCD) ;
\r
178 GPIO_PinAFConfig(GPIOB, GPIO_PinSource12,GPIO_AF_LCD) ;
\r
179 GPIO_PinAFConfig(GPIOB, GPIO_PinSource13,GPIO_AF_LCD) ;
\r
180 GPIO_PinAFConfig(GPIOB, GPIO_PinSource14,GPIO_AF_LCD) ;
\r
181 GPIO_PinAFConfig(GPIOB, GPIO_PinSource15,GPIO_AF_LCD) ;
\r
183 /* Configure Output for LCD */
\r
185 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_6 \
\r
186 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 |GPIO_Pin_11 ;
\r
187 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
\r
188 GPIO_Init( GPIOC, &GPIO_InitStructure);
\r
191 GPIO_PinAFConfig(GPIOC, GPIO_PinSource0,GPIO_AF_LCD) ;
\r
192 GPIO_PinAFConfig(GPIOC, GPIO_PinSource1,GPIO_AF_LCD) ;
\r
193 GPIO_PinAFConfig(GPIOC, GPIO_PinSource2,GPIO_AF_LCD) ;
\r
194 GPIO_PinAFConfig(GPIOC, GPIO_PinSource3,GPIO_AF_LCD) ;
\r
195 GPIO_PinAFConfig(GPIOC, GPIO_PinSource6,GPIO_AF_LCD) ;
\r
196 GPIO_PinAFConfig(GPIOC, GPIO_PinSource7,GPIO_AF_LCD) ;
\r
197 GPIO_PinAFConfig(GPIOC, GPIO_PinSource8,GPIO_AF_LCD) ;
\r
198 GPIO_PinAFConfig(GPIOC, GPIO_PinSource9,GPIO_AF_LCD) ;
\r
199 GPIO_PinAFConfig(GPIOC, GPIO_PinSource10,GPIO_AF_LCD) ;
\r
200 GPIO_PinAFConfig(GPIOC, GPIO_PinSource11,GPIO_AF_LCD) ;
\r
202 /* Disable GPIOs clock */
\r
203 RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |
\r
204 RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH, DISABLE);
\r
209 * @brief LCD contrast setting min-->max-->min by pressing user button
\r
213 void LCD_contrast()
\r
215 uint32_t contrast ;
\r
217 /* To get the actual contrast value in register */
\r
218 contrast = LCD->FCR & LCD_Contrast_Level_7;
\r
220 while ((GPIOC->IDR & USERBUTTON_GPIO_PIN) == 0x0)
\r
222 contrast += LCD_Contrast_Level_1;
\r
224 if (contrast > LCD_Contrast_Level_7)
\r
225 contrast=LCD_Contrast_Level_0;
\r
227 LCD_ContrastConfig(contrast);
\r
233 * @brief Setting bar on LCD, writes bar value in LCD frame buffer
\r
240 LCD->RAM[LCD_RAMRegister_4] &= 0xffff5fff;
\r
241 LCD->RAM[LCD_RAMRegister_6] &= 0xffff5fff;
\r
243 LCD->RAM[LCD_RAMRegister_4] |= (uint32_t)(t_bar[0]<<12);
\r
246 LCD->RAM[LCD_RAMRegister_6] |= (uint32_t)(t_bar[1]<<12);
\r
251 * @brief Converts an ascii char to the a LCD digit.
\r
252 * @param c: a char to display.
\r
253 * @param point: a point to add in front of char
\r
254 * This parameter can be: POINT_OFF or POINT_ON
\r
255 * @param column : flag indicating if a column has to be add in front
\r
256 * of displayed character.
\r
257 * This parameter can be: COLUMN_OFF or COLUMN_ON.
\r
258 * @param digit array with segment
\r
261 static void LCD_Conv_Char_Seg(uint8_t* c,bool point,bool column, uint8_t* digit)
\r
316 ch = NumberMap[*c-0x30];
\r
320 /* The character c is one letter in upper case*/
\r
321 if ( (*c < 0x5b) && (*c > 0x40) )
\r
323 ch = CapLetterMap[*c-'A'];
\r
325 /* The character c is one letter in lower case*/
\r
326 if ( (*c <0x7b) && ( *c> 0x60) )
\r
328 ch = CapLetterMap[*c-'a'];
\r
333 /* Set the digital point can be displayed if the point is on */
\r
339 /* Set the "COL" segment in the character that can be displayed if the column is on */
\r
345 for (i = 12,j=0 ;j<4; i-=4,j++)
\r
347 digit[j] = (ch >> i) & 0x0f; //To isolate the less signifiant dibit
\r
352 * @brief This function writes a char in the LCD frame buffer.
\r
353 * @param ch: the character to display.
\r
354 * @param point: a point to add in front of char
\r
355 * This parameter can be: POINT_OFF or POINT_ON
\r
356 * @param column: flag indicating if a column has to be add in front
\r
357 * of displayed character.
\r
358 * This parameter can be: COLUMN_OFF or COLUMN_ON.
\r
359 * @param position: position in the LCD of the caracter to write [0:7]
\r
361 * @par Required preconditions: The LCD should be cleared before to start the
\r
362 * write operation.
\r
364 void LCD_GLASS_WriteChar(uint8_t* ch, bool point, bool column, uint8_t position)
\r
366 uint8_t digit[4]; /* Digit frame buffer */
\r
368 /* To convert displayed character in segment in array digit */
\r
369 LCD_Conv_Char_Seg(ch,point,column,digit);
\r
374 /* Position 1 on LCD (Digit1)*/
\r
376 LCD->RAM[LCD_RAMRegister_0] &= 0xcffffffc;
\r
377 LCD->RAM[LCD_RAMRegister_2] &= 0xcffffffc;
\r
378 LCD->RAM[LCD_RAMRegister_4] &= 0xcffffffc;
\r
379 LCD->RAM[LCD_RAMRegister_6] &= 0xcffffffc;
\r
381 LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 26 ) | (digit[0]& 0x03) ; // 1G 1B 1M 1E
\r
382 LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 26 ) | (digit[1]& 0x03) ; // 1F 1A 1C 1D
\r
383 LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 26 ) | (digit[2]& 0x03) ; // 1Q 1K 1Col 1P
\r
384 LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 26 ) | (digit[3]& 0x03) ; // 1H 1J 1DP 1N
\r
388 /* Position 2 on LCD (Digit2)*/
\r
390 LCD->RAM[LCD_RAMRegister_0] &= 0xf3ffff03;
\r
391 LCD->RAM[LCD_RAMRegister_2] &= 0xf3ffff03;
\r
392 LCD->RAM[LCD_RAMRegister_4] &= 0xf3ffff03;
\r
393 LCD->RAM[LCD_RAMRegister_6] &= 0xf3ffff03;
\r
395 LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 24 )|((digit[0]& 0x02) << 6 )|((digit[0]& 0x01) << 2 ) ; // 2G 2B 2M 2E
\r
396 LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 24 )|((digit[1]& 0x02) << 6 )|((digit[1]& 0x01) << 2 ) ; // 2F 2A 2C 2D
\r
397 LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 24 )|((digit[2]& 0x02) << 6 )|((digit[2]& 0x01) << 2 ) ; // 2Q 2K 2Col 2P
\r
398 LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 24 )|((digit[3]& 0x02) << 6 )|((digit[3]& 0x01) << 2 ) ; // 2H 2J 2DP 2N
\r
402 /* Position 3 on LCD (Digit3)*/
\r
404 LCD->RAM[LCD_RAMRegister_0] &= 0xfcfffcff;
\r
405 LCD->RAM[LCD_RAMRegister_2] &= 0xfcfffcff;
\r
406 LCD->RAM[LCD_RAMRegister_4] &= 0xfcfffcff;
\r
407 LCD->RAM[LCD_RAMRegister_6] &= 0xfcfffcff;
\r
409 LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 22 ) | ((digit[0]& 0x03) << 8 ) ; // 3G 3B 3M 3E
\r
410 LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 22 ) | ((digit[1]& 0x03) << 8 ) ; // 3F 3A 3C 3D
\r
411 LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 22 ) | ((digit[2]& 0x03) << 8 ) ; // 3Q 3K 3Col 3P
\r
412 LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 22 ) | ((digit[3]& 0x03) << 8 ) ; // 3H 3J 3DP 3N
\r
416 /* Position 4 on LCD (Digit4)*/
\r
418 LCD->RAM[LCD_RAMRegister_0] &= 0xffcff3ff;
\r
419 LCD->RAM[LCD_RAMRegister_2] &= 0xffcff3ff;
\r
420 LCD->RAM[LCD_RAMRegister_4] &= 0xffcff3ff;
\r
421 LCD->RAM[LCD_RAMRegister_6] &= 0xffcff3ff;
\r
423 LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 18 ) | ((digit[0]& 0x03) << 10 ) ; // 4G 4B 4M 4E
\r
424 LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 18 ) | ((digit[1]& 0x03) << 10 ) ; // 4F 4A 4C 4D
\r
425 LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 18 ) | ((digit[2]& 0x03) << 10 ) ; // 4Q 4K 4Col 4P
\r
426 LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 18 ) | ((digit[3]& 0x03) << 10 ) ; // 4H 4J 4DP 4N
\r
430 /* Position 5 on LCD (Digit5)*/
\r
432 LCD->RAM[LCD_RAMRegister_0] &= 0xfff3cfff;
\r
433 LCD->RAM[LCD_RAMRegister_2] &= 0xfff3cfff;
\r
434 LCD->RAM[LCD_RAMRegister_4] &= 0xfff3efff;
\r
435 LCD->RAM[LCD_RAMRegister_6] &= 0xfff3efff;
\r
437 LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x0c) << 16 ) | ((digit[0]& 0x03) << 12 ) ; // 5G 5B 5M 5E
\r
438 LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x0c) << 16 ) | ((digit[1]& 0x03) << 12 ) ; // 5F 5A 5C 5D
\r
439 LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x0c) << 16 ) | ((digit[2]& 0x01) << 12 ) ; // 5Q 5K 5P
\r
440 LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x0c) << 16 ) | ((digit[3]& 0x01) << 12 ) ; // 5H 5J 5N
\r
444 /* Position 6 on LCD (Digit6)*/
\r
446 LCD->RAM[LCD_RAMRegister_0] &= 0xfffc3fff;
\r
447 LCD->RAM[LCD_RAMRegister_2] &= 0xfffc3fff;
\r
448 LCD->RAM[LCD_RAMRegister_4] &= 0xfffc3fff;
\r
449 LCD->RAM[LCD_RAMRegister_6] &= 0xfffc3fff;
\r
451 LCD->RAM[LCD_RAMRegister_0] |= ((digit[0]& 0x04) << 15 ) | ((digit[0]& 0x08) << 13 ) | ((digit[0]& 0x03) << 14 ) ; // 6B 6G 6M 6E
\r
452 LCD->RAM[LCD_RAMRegister_2] |= ((digit[1]& 0x04) << 15 ) | ((digit[1]& 0x08) << 13 ) | ((digit[1]& 0x03) << 14 ) ; // 6A 6F 6C 6D
\r
453 LCD->RAM[LCD_RAMRegister_4] |= ((digit[2]& 0x04) << 15 ) | ((digit[2]& 0x08) << 13 ) | ((digit[2]& 0x01) << 14 ) ; // 6K 6Q 6P
\r
454 LCD->RAM[LCD_RAMRegister_6] |= ((digit[3]& 0x04) << 15 ) | ((digit[3]& 0x08) << 13 ) | ((digit[3]& 0x01) << 14 ) ; // 6J 6H 6N
\r
462 /* Refresh LCD bar */
\r
468 * @brief This function writes a char in the LCD RAM.
\r
469 * @param ptr: Pointer to string to display on the LCD Glass.
\r
472 void LCD_GLASS_DisplayString(uint8_t* ptr)
\r
476 /* wait for LCD Ready */
\r
477 while( LCD_GetFlagStatus (LCD_FLAG_UDR) != RESET) ;
\r
479 /* Send the string character by character on lCD */
\r
480 while ((*ptr != 0) & (i < 8))
\r
482 /* Display one character on LCD */
\r
483 LCD_GLASS_WriteChar(ptr, FALSE, FALSE, i);
\r
485 /* Point on the next character */
\r
488 /* Increment the character counter */
\r
492 /* Update the LCD display */
\r
493 LCD_UpdateDisplayRequest();
\r
497 * @brief This function writes a char in the LCD RAM.
\r
498 * @param ptr: Pointer to string to display on the LCD Glass.
\r
500 * @par Required preconditions: Char is ASCCI value "Ored" with decimal point or Column flag
\r
502 void LCD_GLASS_DisplayStrDeci(uint16_t* ptr)
\r
507 /* TO wait LCD Ready */
\r
508 while( LCD_GetFlagStatus (LCD_FLAG_UDR) != RESET) ;
\r
510 /* Send the string character by character on lCD */
\r
511 while ((*ptr != 0) & (i < 8))
\r
513 char_tmp = (*ptr) & 0x00ff;
\r
515 switch ((*ptr) & 0xf000)
\r
518 /* Display one character on LCD with decimal point */
\r
519 LCD_GLASS_WriteChar(&char_tmp, POINT_ON, COLUMN_OFF, i);
\r
522 /* Display one character on LCD with decimal point */
\r
523 LCD_GLASS_WriteChar(&char_tmp, POINT_OFF, COLUMN_ON, i);
\r
526 LCD_GLASS_WriteChar(&char_tmp, POINT_OFF, COLUMN_OFF, i);
\r
528 }/* Point on the next character */
\r
531 /* Increment the character counter */
\r
534 /* Update the LCD display */
\r
535 LCD_UpdateDisplayRequest();
\r
539 * @brief This function Clear the whole LCD RAM.
\r
543 void LCD_GLASS_Clear(void)
\r
545 uint32_t counter = 0;
\r
547 /* TO wait LCD Ready */
\r
548 while( LCD_GetFlagStatus (LCD_FLAG_UDR) != RESET) ;
\r
550 for (counter = LCD_RAMRegister_0; counter <= LCD_RAMRegister_15; counter++)
\r
552 LCD->RAM[counter] = 0;
\r
555 /* Update the LCD display */
\r
556 LCD_UpdateDisplayRequest();
\r
561 * @brief Display a string in scrolling mode
\r
562 * @param ptr: Pointer to string to display on the LCD Glass.
\r
563 * @param nScroll: Specifies how many time the message will be scrolled
\r
564 * @param ScrollSpeed : Speciifes the speed of the scroll, low value gives
\r
567 * @par Required preconditions: The LCD should be cleared before to start the
\r
570 void LCD_GLASS_ScrollSentence(uint8_t* ptr, uint16_t nScroll, uint16_t ScrollSpeed)
\r
572 uint8_t Repetition;
\r
578 if (ptr == 0) return;
\r
580 /* To calculate end of string */
\r
581 for (ptr1=ptr,Str_size = 0 ; *ptr1 != 0; Str_size++,ptr1++) ;
\r
585 LCD_GLASS_DisplayString(ptr);
\r
586 Delay(ScrollSpeed);
\r
588 /* To shift the string for scrolling display*/
\r
589 for (Repetition=0; Repetition<nScroll; Repetition++)
\r
591 for (Char_Nb=0; Char_Nb<Str_size; Char_Nb++)
\r
593 *(str) =* (ptr1+((Char_Nb+1)%Str_size));
\r
594 *(str+1) =* (ptr1+((Char_Nb+2)%Str_size));
\r
595 *(str+2) =* (ptr1+((Char_Nb+3)%Str_size));
\r
596 *(str+3) =* (ptr1+((Char_Nb+4)%Str_size));
\r
597 *(str+4) =* (ptr1+((Char_Nb+5)%Str_size));
\r
598 *(str+5) =* (ptr1+((Char_Nb+6)%Str_size));
\r
600 LCD_GLASS_DisplayString(str);
\r
602 /* user button pressed stop the scrolling sentence */
\r
605 Delay(ScrollSpeed);
\r
611 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
\r