Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
stm32l476g_discovery_glass_lcd.c
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l476g_discovery_glass_lcd.c 00004 * @author MCD Application Team 00005 * @brief This file provides a set of functions needed to manage the 00006 * LCD Glass driver for the STM32L476G-Discovery board. 00007 ****************************************************************************** 00008 * @attention 00009 * 00010 * <h2><center>© Copyright (c) 2016 STMicroelectronics. 00011 * All rights reserved.</center></h2> 00012 * 00013 * This software component is licensed by ST under BSD 3-Clause license, 00014 * the "License"; You may not use this file except in compliance with the 00015 * License. You may obtain a copy of the License at: 00016 * opensource.org/licenses/BSD-3-Clause 00017 * 00018 ****************************************************************************** 00019 */ 00020 00021 /* Includes ------------------------------------------------------------------*/ 00022 #include "stm32l476g_discovery_glass_lcd.h" 00023 00024 /** @addtogroup BSP 00025 * @{ 00026 */ 00027 00028 /** @addtogroup STM32L476G_DISCOVERY 00029 * @{ 00030 */ 00031 00032 /** @defgroup STM32L476G_DISCOVERY_GLASS_LCD STM32L476G-DISCOVERY GLASS LCD 00033 * @brief This file includes the LCD Glass driver for LCD Module of 00034 * STM32L476G-DISCOVERY board. 00035 * @{ 00036 */ 00037 00038 /* Private constants ---------------------------------------------------------*/ 00039 00040 /** @defgroup STM32L476G_DISCOVERY_GLASS_LCD_Private_Constants Private Constants 00041 * @{ 00042 */ 00043 #define ASCII_CHAR_0 0x30 /* 0 */ 00044 #define ASCII_CHAR_AT_SYMBOL 0x40 /* @ */ 00045 #define ASCII_CHAR_LEFT_OPEN_BRACKET 0x5B /* [ */ 00046 #define ASCII_CHAR_APOSTROPHE 0x60 /* ` */ 00047 #define ASCII_CHAR_LEFT_OPEN_BRACE 0x7B /* ( */ 00048 /** 00049 * @} 00050 */ 00051 00052 /* Private variables ---------------------------------------------------------*/ 00053 00054 /** @defgroup STM32L476G_DISCOVERY_GLASS_LCD_Private_Variables Private Variables 00055 * @{ 00056 */ 00057 00058 /* this variable can be used for accelerate the scrolling exit when push user button */ 00059 __IO uint8_t bLCDGlass_KeyPressed = 0; 00060 00061 /** 00062 @verbatim 00063 ================================================================================ 00064 GLASS LCD MAPPING 00065 ================================================================================ 00066 LCD allows to display informations on six 14-segment digits and 4 bars: 00067 00068 1 2 3 4 5 6 00069 ----- ----- ----- ----- ----- ----- 00070 |\|/| o |\|/| o |\|/| o |\|/| o |\|/| |\|/| BAR3 00071 -- -- -- -- -- -- -- -- -- -- -- -- BAR2 00072 |/|\| o |/|\| o |/|\| o |/|\| o |/|\| |/|\| BAR1 00073 ----- * ----- * ----- * ----- * ----- ----- BAR0 00074 00075 LCD segment mapping: 00076 -------------------- 00077 -----A----- _ 00078 |\ | /| COL |_| 00079 F H J K B 00080 | \ | / | _ 00081 --G-- --M-- COL |_| 00082 | / | \ | 00083 E Q P N C 00084 |/ | \| _ 00085 -----D----- DP |_| 00086 00087 An LCD character coding is based on the following matrix: 00088 COM 0 1 2 3 00089 SEG(n) { E , D , P , N } 00090 SEG(n+1) { M , C , COL , DP } 00091 SEG(23-n-1) { B , A , K , J } 00092 SEG(23-n) { G , F , Q , H } 00093 with n positive odd number. 00094 00095 The character 'A' for example is: 00096 ------------------------------- 00097 LSB { 1 , 0 , 0 , 0 } 00098 { 1 , 1 , 0 , 0 } 00099 { 1 , 1 , 0 , 0 } 00100 MSB { 1 , 1 , 0 , 0 } 00101 ------------------- 00102 'A' = F E 0 0 hexa 00103 00104 @endverbatim 00105 */ 00106 00107 LCD_HandleTypeDef LCDHandle ; 00108 00109 /* Constant table for cap characters 'A' --> 'Z' */ 00110 const uint16_t CapLetterMap[26] = 00111 { 00112 /* A B C D E F G H I */ 00113 0xFE00, 0x6714, 0x1D00, 0x4714, 0x9D00, 0x9C00, 0x3F00, 0xFA00, 0x0014, 00114 /* J K L M N O P Q R */ 00115 0x5300, 0x9841, 0x1900, 0x5A48, 0x5A09, 0x5F00, 0xFC00, 0x5F01, 0xFC01, 00116 /* S T U V W X Y Z */ 00117 0xAF00, 0x0414, 0x5b00, 0x18C0, 0x5A81, 0x00C9, 0x0058, 0x05C0 00118 }; 00119 00120 /* Constant table for number '0' --> '9' */ 00121 const uint16_t NumberMap[10] = 00122 { 00123 /* 0 1 2 3 4 5 6 7 8 9 */ 00124 0x5F00, 0x4200, 0xF500, 0x6700, 0xEa00, 0xAF00, 0xBF00, 0x04600, 0xFF00, 0xEF00 00125 }; 00126 00127 uint32_t Digit[4]; /* Digit frame buffer */ 00128 00129 /* LCD BAR status: To save the bar setting after writing in LCD RAM memory */ 00130 uint8_t LCDBar = BATTERYLEVEL_FULL; 00131 00132 /** 00133 * @} 00134 */ 00135 00136 /** @defgroup STM32L476G_DISCOVERY_LCD_Private_Functions Private Functions 00137 * @{ 00138 */ 00139 static void Convert(uint8_t *Char, Point_Typedef Point, DoublePoint_Typedef Colon); 00140 static void WriteChar(uint8_t *ch, Point_Typedef Point, DoublePoint_Typedef Colon, DigitPosition_Typedef Position); 00141 static void LCD_MspInit(LCD_HandleTypeDef *hlcd); 00142 static void LCD_MspDeInit(LCD_HandleTypeDef *hlcd); 00143 00144 /** 00145 * @} 00146 */ 00147 00148 /** @addtogroup STM32L476G_DISCOVERY_LCD_Exported_Functions 00149 * @{ 00150 */ 00151 00152 /** 00153 * @brief Initialize the LCD GLASS relative GPIO port IOs and LCD peripheral. 00154 * @retval None 00155 */ 00156 void BSP_LCD_GLASS_Init(void) 00157 { 00158 LCDHandle .Instance = LCD; 00159 LCDHandle .Init.Prescaler = LCD_PRESCALER_1; 00160 LCDHandle .Init.Divider = LCD_DIVIDER_31; 00161 #if defined (USE_STM32L476G_DISCO_REVC) || defined (USE_STM32L476G_DISCO_REVB) 00162 LCDHandle .Init.Duty = LCD_DUTY_1_4; 00163 #elif defined (USE_STM32L476G_DISCO_REVA) 00164 LCDHandle .Init.Duty = LCD_DUTY_1_8; 00165 #endif 00166 LCDHandle .Init.Bias = LCD_BIAS_1_3; 00167 LCDHandle .Init.VoltageSource = LCD_VOLTAGESOURCE_INTERNAL; 00168 LCDHandle .Init.Contrast = LCD_CONTRASTLEVEL_5; 00169 LCDHandle .Init.DeadTime = LCD_DEADTIME_0; 00170 LCDHandle .Init.PulseOnDuration = LCD_PULSEONDURATION_4; 00171 LCDHandle .Init.HighDrive = LCD_HIGHDRIVE_DISABLE; 00172 LCDHandle .Init.BlinkMode = LCD_BLINKMODE_OFF; 00173 LCDHandle .Init.BlinkFrequency = LCD_BLINKFREQUENCY_DIV32; 00174 LCDHandle .Init.MuxSegment = LCD_MUXSEGMENT_DISABLE; 00175 00176 /* Initialize the LCD */ 00177 LCD_MspInit(&LCDHandle ); 00178 HAL_LCD_Init(&LCDHandle ); 00179 00180 BSP_LCD_GLASS_Clear(); 00181 } 00182 00183 /** 00184 * @brief DeInitialize the LCD GLASS relative GPIO port IOs and LCD peripheral. 00185 * @retval None 00186 */ 00187 void BSP_LCD_GLASS_DeInit(void) 00188 { 00189 /* De-Initialize the LCD */ 00190 LCD_MspDeInit(&LCDHandle ); 00191 HAL_LCD_DeInit(&LCDHandle ); 00192 } 00193 00194 00195 /** 00196 * @brief Configure the LCD Blink mode and Blink frequency. 00197 * @param BlinkMode: specifies the LCD blink mode. 00198 * This parameter can be one of the following values: 00199 * @arg LCD_BLINKMODE_OFF: Blink disabled 00200 * @arg LCD_BLINKMODE_SEG0_COM0: Blink enabled on SEG[0], COM[0] (1 pixel) 00201 * @arg LCD_BLINKMODE_SEG0_ALLCOM: Blink enabled on SEG[0], all COM (up to 8 00202 * pixels according to the programmed duty) 00203 * @arg LCD_BLINKMODE_ALLSEG_ALLCOM: Blink enabled on all SEG and all COM 00204 * (all pixels) 00205 * @param BlinkFrequency: specifies the LCD blink frequency. 00206 * @arg LCD_BLINKFREQUENCY_DIV8: The Blink frequency = fLcd/8 00207 * @arg LCD_BLINKFREQUENCY_DIV16: The Blink frequency = fLcd/16 00208 * @arg LCD_BLINKFREQUENCY_DIV32: The Blink frequency = fLcd/32 00209 * @arg LCD_BLINKFREQUENCY_DIV64: The Blink frequency = fLcd/64 00210 * @arg LCD_BLINKFREQUENCY_DIV128: The Blink frequency = fLcd/128 00211 * @arg LCD_BLINKFREQUENCY_DIV256: The Blink frequency = fLcd/256 00212 * @arg LCD_BLINKFREQUENCY_DIV512: The Blink frequency = fLcd/512 00213 * @arg LCD_BLINKFREQUENCY_DIV1024: The Blink frequency = fLcd/1024 00214 * @retval None 00215 */ 00216 void BSP_LCD_GLASS_BlinkConfig(uint32_t BlinkMode, uint32_t BlinkFrequency) 00217 { 00218 __HAL_LCD_BLINK_CONFIG(&LCDHandle , BlinkMode, BlinkFrequency); 00219 } 00220 00221 /** 00222 * @brief Configure the LCD contrast. 00223 * @param Contrast: specifies the LCD contrast value. 00224 * This parameter can be one of the following values: 00225 * @arg LCD_CONTRASTLEVEL_0: Maximum Voltage = 2.60V 00226 * @arg LCD_CONTRASTLEVEL_1: Maximum Voltage = 2.73V 00227 * @arg LCD_CONTRASTLEVEL_2: Maximum Voltage = 2.86V 00228 * @arg LCD_CONTRASTLEVEL_3: Maximum Voltage = 2.99V 00229 * @arg LCD_CONTRASTLEVEL_4: Maximum Voltage = 3.12V 00230 * @arg LCD_CONTRASTLEVEL_5: Maximum Voltage = 3.25V 00231 * @arg LCD_CONTRASTLEVEL_6: Maximum Voltage = 3.38V 00232 * @arg LCD_CONTRASTLEVEL_7: Maximum Voltage = 3.51V 00233 * @retval None 00234 */ 00235 void BSP_LCD_GLASS_Contrast(uint32_t Contrast) 00236 { 00237 __HAL_LCD_CONTRAST_CONFIG(&LCDHandle , Contrast); 00238 } 00239 00240 /** 00241 * @brief Display one or several bar in LCD frame buffer. 00242 * @param BarId: specifies the LCD GLASS Bar to display 00243 * This parameter can be one of the following values: 00244 * @arg BAR0: LCD GLASS Bar 0 00245 * @arg BAR0: LCD GLASS Bar 1 00246 * @arg BAR0: LCD GLASS Bar 2 00247 * @arg BAR0: LCD GLASS Bar 3 00248 * @retval None 00249 */ 00250 void BSP_LCD_GLASS_DisplayBar(uint32_t BarId) 00251 { 00252 uint32_t position = 0; 00253 00254 /* Check which bar is selected */ 00255 while ((BarId) >> position) 00256 { 00257 /* Check if current bar is selected */ 00258 switch (BarId & (1 << position)) 00259 { 00260 /* Bar 0 */ 00261 case LCD_BAR_0: 00262 /* Set BAR0 */ 00263 HAL_LCD_Write(&LCDHandle , LCD_BAR0_2_COM, ~(LCD_BAR0_SEG), LCD_BAR0_SEG); 00264 break; 00265 00266 /* Bar 1 */ 00267 case LCD_BAR_1: 00268 /* Set BAR1 */ 00269 HAL_LCD_Write(&LCDHandle , LCD_BAR1_3_COM, ~(LCD_BAR1_SEG), LCD_BAR1_SEG); 00270 break; 00271 00272 /* Bar 2 */ 00273 case LCD_BAR_2: 00274 /* Set BAR2 */ 00275 HAL_LCD_Write(&LCDHandle , LCD_BAR0_2_COM, ~(LCD_BAR2_SEG), LCD_BAR2_SEG); 00276 break; 00277 00278 /* Bar 3 */ 00279 case LCD_BAR_3: 00280 /* Set BAR3 */ 00281 HAL_LCD_Write(&LCDHandle , LCD_BAR1_3_COM, ~(LCD_BAR3_SEG), LCD_BAR3_SEG); 00282 break; 00283 00284 default: 00285 break; 00286 } 00287 position++; 00288 } 00289 00290 /* Update the LCD display */ 00291 HAL_LCD_UpdateDisplayRequest(&LCDHandle ); 00292 } 00293 00294 /** 00295 * @brief Clear one or several bar in LCD frame buffer. 00296 * @param BarId: specifies the LCD GLASS Bar to display 00297 * This parameter can be combination of one of the following values: 00298 * @arg LCD_BAR_0: LCD GLASS Bar 0 00299 * @arg LCD_BAR_1: LCD GLASS Bar 1 00300 * @arg LCD_BAR_2: LCD GLASS Bar 2 00301 * @arg LCD_BAR_3: LCD GLASS Bar 3 00302 * @retval None 00303 */ 00304 void BSP_LCD_GLASS_ClearBar(uint32_t BarId) 00305 { 00306 uint32_t position = 0; 00307 00308 /* Check which bar is selected */ 00309 while ((BarId) >> position) 00310 { 00311 /* Check if current bar is selected */ 00312 switch (BarId & (1 << position)) 00313 { 00314 /* Bar 0 */ 00315 case LCD_BAR_0: 00316 /* Set BAR0 */ 00317 HAL_LCD_Write(&LCDHandle , LCD_BAR0_2_COM, ~(LCD_BAR0_SEG) , 0); 00318 break; 00319 00320 /* Bar 1 */ 00321 case LCD_BAR_1: 00322 /* Set BAR1 */ 00323 HAL_LCD_Write(&LCDHandle , LCD_BAR1_3_COM, ~(LCD_BAR1_SEG), 0); 00324 break; 00325 00326 /* Bar 2 */ 00327 case LCD_BAR_2: 00328 /* Set BAR2 */ 00329 HAL_LCD_Write(&LCDHandle , LCD_BAR0_2_COM, ~(LCD_BAR2_SEG), 0); 00330 break; 00331 00332 /* Bar 3 */ 00333 case LCD_BAR_3: 00334 /* Set BAR3 */ 00335 HAL_LCD_Write(&LCDHandle , LCD_BAR1_3_COM, ~(LCD_BAR3_SEG), 0); 00336 break; 00337 00338 default: 00339 break; 00340 } 00341 position++; 00342 } 00343 00344 /* Update the LCD display */ 00345 HAL_LCD_UpdateDisplayRequest(&LCDHandle ); 00346 } 00347 00348 /** 00349 * @brief Configure the bar level on LCD by writing bar value in LCD frame buffer. 00350 * @param BarLevel: specifies the LCD GLASS Battery Level. 00351 * This parameter can be one of the following values: 00352 * @arg BATTERYLEVEL_OFF: LCD GLASS Battery Empty 00353 * @arg BATTERYLEVEL_1_4: LCD GLASS Battery 1/4 Full 00354 * @arg BATTERYLEVEL_1_2: LCD GLASS Battery 1/2 Full 00355 * @arg BATTERYLEVEL_3_4: LCD GLASS Battery 3/4 Full 00356 * @arg BATTERYLEVEL_FULL: LCD GLASS Battery Full 00357 * @retval None 00358 */ 00359 void BSP_LCD_GLASS_BarLevelConfig(uint8_t BarLevel) 00360 { 00361 switch (BarLevel) 00362 { 00363 /* BATTERYLEVEL_OFF */ 00364 case BATTERYLEVEL_OFF: 00365 /* Set BAR0 & BAR2 off */ 00366 HAL_LCD_Write(&LCDHandle , LCD_BAR0_2_COM, ~(LCD_BAR0_SEG | LCD_BAR2_SEG), 0); 00367 /* Set BAR1 & BAR3 off */ 00368 HAL_LCD_Write(&LCDHandle , LCD_BAR1_3_COM, ~(LCD_BAR1_SEG | LCD_BAR3_SEG), 0); 00369 LCDBar = BATTERYLEVEL_OFF; 00370 break; 00371 00372 /* BARLEVEL 1/4 */ 00373 case BATTERYLEVEL_1_4: 00374 /* Set BAR0 on & BAR2 off */ 00375 HAL_LCD_Write(&LCDHandle , LCD_BAR0_2_COM, ~(LCD_BAR0_SEG | LCD_BAR2_SEG), LCD_BAR0_SEG); 00376 /* Set BAR1 & BAR3 off */ 00377 HAL_LCD_Write(&LCDHandle , LCD_BAR1_3_COM, ~(LCD_BAR1_SEG | LCD_BAR3_SEG), 0); 00378 LCDBar = BATTERYLEVEL_1_4; 00379 break; 00380 00381 /* BARLEVEL 1/2 */ 00382 case BATTERYLEVEL_1_2: 00383 /* Set BAR0 on & BAR2 off */ 00384 HAL_LCD_Write(&LCDHandle , LCD_BAR0_2_COM, ~(LCD_BAR0_SEG | LCD_BAR2_SEG), LCD_BAR0_SEG); 00385 /* Set BAR1 on & BAR3 off */ 00386 HAL_LCD_Write(&LCDHandle , LCD_BAR1_3_COM, ~(LCD_BAR1_SEG | LCD_BAR3_SEG), LCD_BAR1_SEG); 00387 LCDBar = BATTERYLEVEL_1_2; 00388 break; 00389 00390 /* Battery Level 3/4 */ 00391 case BATTERYLEVEL_3_4: 00392 /* Set BAR0 & BAR2 on */ 00393 HAL_LCD_Write(&LCDHandle , LCD_BAR0_2_COM, ~(LCD_BAR0_SEG | LCD_BAR2_SEG), (LCD_BAR0_SEG | LCD_BAR2_SEG)); 00394 /* Set BAR1 on & BAR3 off */ 00395 HAL_LCD_Write(&LCDHandle , LCD_BAR1_3_COM, ~(LCD_BAR1_SEG | LCD_BAR3_SEG), LCD_BAR1_SEG); 00396 LCDBar = BATTERYLEVEL_3_4; 00397 break; 00398 00399 /* BATTERYLEVEL_FULL */ 00400 case BATTERYLEVEL_FULL: 00401 /* Set BAR0 & BAR2 on */ 00402 HAL_LCD_Write(&LCDHandle , LCD_BAR0_2_COM, ~(LCD_BAR0_SEG | LCD_BAR2_SEG), (LCD_BAR0_SEG | LCD_BAR2_SEG)); 00403 /* Set BAR1 on & BAR3 on */ 00404 HAL_LCD_Write(&LCDHandle , LCD_BAR1_3_COM, ~(LCD_BAR1_SEG | LCD_BAR3_SEG), (LCD_BAR1_SEG | LCD_BAR3_SEG)); 00405 LCDBar = BATTERYLEVEL_FULL; 00406 break; 00407 00408 default: 00409 break; 00410 } 00411 00412 /* Update the LCD display */ 00413 HAL_LCD_UpdateDisplayRequest(&LCDHandle ); 00414 } 00415 00416 /** 00417 * @brief Write a character in the LCD RAM buffer. 00418 * @param ch: The character to display. 00419 * @param Point: A point to add in front of char. 00420 * This parameter can be one of the following values: 00421 * @arg POINT_OFF: No point to add in front of char. 00422 * @arg POINT_ON: Add a point in front of char. 00423 * @param Colon: Flag indicating if a colon character has to be added in front 00424 * of displayed character. 00425 * This parameter can be one of the following values: 00426 * @arg DOUBLEPOINT_OFF: No colon to add in back of char. 00427 * @arg DOUBLEPOINT_ON: Add an colon in back of char. 00428 * @param Position: Position in the LCD of the character to write. 00429 * This parameter can be any value in range [1:6]. 00430 * @retval None 00431 * @note Required preconditions: The LCD should be cleared before to start the 00432 * write operation. 00433 */ 00434 void BSP_LCD_GLASS_DisplayChar(uint8_t *ch, Point_Typedef Point, DoublePoint_Typedef Colon, DigitPosition_Typedef Position) 00435 { 00436 WriteChar(ch, Point, Colon, Position); 00437 00438 /* Update the LCD display */ 00439 HAL_LCD_UpdateDisplayRequest(&LCDHandle ); 00440 } 00441 00442 /** 00443 * @brief Write a character string in the LCD RAM buffer. 00444 * @param ptr: Pointer to string to display on the LCD Glass. 00445 * @retval None 00446 */ 00447 void BSP_LCD_GLASS_DisplayString(uint8_t *ptr) 00448 { 00449 DigitPosition_Typedef position = LCD_DIGIT_POSITION_1; 00450 00451 /* Send the string character by character on lCD */ 00452 while ((*ptr != 0) && (position <= LCD_DIGIT_POSITION_6)) 00453 { 00454 /* Write one character on LCD */ 00455 WriteChar(ptr, POINT_OFF, DOUBLEPOINT_OFF, position); 00456 00457 /* Point on the next character */ 00458 ptr++; 00459 00460 /* Increment the character counter */ 00461 position++; 00462 } 00463 /* Update the LCD display */ 00464 HAL_LCD_UpdateDisplayRequest(&LCDHandle ); 00465 } 00466 00467 /** 00468 * @brief Write a character string with decimal point in the LCD RAM buffer. 00469 * @param ptr: Pointer to string to display on the LCD Glass. 00470 * @retval None 00471 * @note Required preconditions: Char is ASCCI value "ORed" with decimal point or Colon flag 00472 */ 00473 void BSP_LCD_GLASS_DisplayStrDeci(uint16_t *ptr) 00474 { 00475 DigitPosition_Typedef index = LCD_DIGIT_POSITION_1; 00476 uint8_t tmpchar = 0; 00477 00478 /* Send the string character by character on lCD */ 00479 while ((*ptr != 0) && (index <= LCD_DIGIT_POSITION_6)) 00480 { 00481 tmpchar = (*ptr) & 0x00FF; 00482 00483 switch ((*ptr) & 0xF000) 00484 { 00485 case DOT: 00486 /* Write one character on LCD with decimal point */ 00487 WriteChar(&tmpchar, POINT_ON, DOUBLEPOINT_OFF, index); 00488 break; 00489 case DOUBLE_DOT: 00490 /* Write one character on LCD with decimal point */ 00491 WriteChar(&tmpchar, POINT_OFF, DOUBLEPOINT_ON, index); 00492 break; 00493 default: 00494 WriteChar(&tmpchar, POINT_OFF, DOUBLEPOINT_OFF, index); 00495 break; 00496 }/* Point on the next character */ 00497 ptr++; 00498 00499 /* Increment the character counter */ 00500 index++; 00501 } 00502 /* Update the LCD display */ 00503 HAL_LCD_UpdateDisplayRequest(&LCDHandle ); 00504 } 00505 00506 /** 00507 * @brief Clear the whole LCD RAM buffer. 00508 * @retval None 00509 */ 00510 void BSP_LCD_GLASS_Clear(void) 00511 { 00512 HAL_LCD_Clear(&LCDHandle ); 00513 } 00514 00515 /** 00516 * @brief Display a string in scrolling mode 00517 * @param ptr: Pointer to string to display on the LCD Glass. 00518 * @param nScroll: Specifies how many time the message will be scrolled 00519 * @param ScrollSpeed : Specifies the speed of the scroll, low value gives 00520 * higher speed 00521 * @retval None 00522 * @note Required preconditions: The LCD should be cleared before to start the 00523 * write operation. 00524 */ 00525 void BSP_LCD_GLASS_ScrollSentence(uint8_t *ptr, uint16_t nScroll, uint16_t ScrollSpeed) 00526 { 00527 uint8_t repetition = 0, nbrchar = 0, sizestr = 0; 00528 uint8_t *ptr1; 00529 uint8_t str[6] = ""; 00530 00531 /* Reset interrupt variable in case key was press before entering function */ 00532 bLCDGlass_KeyPressed = 0; 00533 00534 if (ptr == 0) 00535 { 00536 return; 00537 } 00538 00539 /* To calculate end of string */ 00540 for (ptr1 = ptr, sizestr = 0; *ptr1 != 0; sizestr++, ptr1++); 00541 00542 ptr1 = ptr; 00543 00544 BSP_LCD_GLASS_DisplayString(str); 00545 HAL_Delay(ScrollSpeed); 00546 00547 /* To shift the string for scrolling display*/ 00548 for (repetition = 0; repetition < nScroll; repetition++) 00549 { 00550 for (nbrchar = 0; nbrchar < sizestr; nbrchar++) 00551 { 00552 *(str) = * (ptr1 + ((nbrchar + 1) % sizestr)); 00553 *(str + 1) = * (ptr1 + ((nbrchar + 2) % sizestr)); 00554 *(str + 2) = * (ptr1 + ((nbrchar + 3) % sizestr)); 00555 *(str + 3) = * (ptr1 + ((nbrchar + 4) % sizestr)); 00556 *(str + 4) = * (ptr1 + ((nbrchar + 5) % sizestr)); 00557 *(str + 5) = * (ptr1 + ((nbrchar + 6) % sizestr)); 00558 BSP_LCD_GLASS_Clear(); 00559 BSP_LCD_GLASS_DisplayString(str); 00560 00561 /* user button pressed stop the scrolling sentence */ 00562 if (bLCDGlass_KeyPressed) 00563 { 00564 bLCDGlass_KeyPressed = 0; 00565 return; 00566 } 00567 HAL_Delay(ScrollSpeed); 00568 } 00569 } 00570 } 00571 00572 /** 00573 * @} 00574 */ 00575 00576 /** @addtogroup STM32L476G_DISCOVERY_LCD_Private_Functions 00577 * @{ 00578 */ 00579 00580 /** 00581 * @brief Initialize the LCD MSP. 00582 * @param hlcd: LCD handle 00583 * @retval None 00584 */ 00585 static void LCD_MspInit(LCD_HandleTypeDef *hlcd) 00586 { 00587 GPIO_InitTypeDef gpioinitstruct = {0}; 00588 RCC_OscInitTypeDef oscinitstruct = {0}; 00589 RCC_PeriphCLKInitTypeDef periphclkstruct = {0}; 00590 00591 /*##-1- Enable PWR peripheral Clock #######################################*/ 00592 __HAL_RCC_PWR_CLK_ENABLE(); 00593 00594 /*##-2- Configure LSE as RTC clock soucre ###################################*/ 00595 oscinitstruct.OscillatorType = RCC_OSCILLATORTYPE_LSE; 00596 oscinitstruct.PLL.PLLState = RCC_PLL_NONE; 00597 oscinitstruct.LSEState = RCC_LSE_ON; 00598 if (HAL_RCC_OscConfig(&oscinitstruct) != HAL_OK) 00599 { 00600 while (1); 00601 } 00602 00603 /*##-3- Select LSE as RTC clock source.##########################*/ 00604 /* Backup domain management is done in RCC function */ 00605 periphclkstruct.PeriphClockSelection = RCC_PERIPHCLK_RTC; 00606 periphclkstruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; 00607 HAL_RCCEx_PeriphCLKConfig(&periphclkstruct); 00608 00609 /*##-4- Enable LCD GPIO Clocks #############################################*/ 00610 __HAL_RCC_GPIOA_CLK_ENABLE(); 00611 __HAL_RCC_GPIOB_CLK_ENABLE(); 00612 __HAL_RCC_GPIOC_CLK_ENABLE(); 00613 __HAL_RCC_GPIOD_CLK_ENABLE(); 00614 00615 00616 /*##-5- Configure peripheral GPIO ##########################################*/ 00617 /* Configure Output for LCD */ 00618 /* Port A */ 00619 gpioinitstruct.Pin = LCD_GPIO_BANKA_PINS; 00620 gpioinitstruct.Mode = GPIO_MODE_AF_PP; 00621 gpioinitstruct.Pull = GPIO_NOPULL; 00622 gpioinitstruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; 00623 gpioinitstruct.Alternate = GPIO_AF11_LCD; 00624 HAL_GPIO_Init(GPIOA, &gpioinitstruct); 00625 00626 /* Port B */ 00627 gpioinitstruct.Pin = LCD_GPIO_BANKB_PINS; 00628 HAL_GPIO_Init(GPIOB, &gpioinitstruct); 00629 00630 /* Port C*/ 00631 gpioinitstruct.Pin = LCD_GPIO_BANKC_PINS; 00632 HAL_GPIO_Init(GPIOC, &gpioinitstruct); 00633 00634 /* Port D */ 00635 gpioinitstruct.Pin = LCD_GPIO_BANKD_PINS; 00636 HAL_GPIO_Init(GPIOD, &gpioinitstruct); 00637 00638 /* Wait for the external capacitor Cext which is connected to the VLCD pin is charged 00639 (approximately 2ms for Cext=1uF) */ 00640 HAL_Delay(2); 00641 00642 /*##-6- Enable LCD peripheral Clock ########################################*/ 00643 __HAL_RCC_LCD_CLK_ENABLE(); 00644 } 00645 00646 /** 00647 * @brief DeInitialize the LCD MSP. 00648 * @param hlcd: LCD handle 00649 * @retval None 00650 */ 00651 static void LCD_MspDeInit(LCD_HandleTypeDef *hlcd) 00652 { 00653 uint32_t gpiopin = 0; 00654 00655 /*##-1- Enable LCD GPIO Clocks #############################################*/ 00656 __HAL_RCC_GPIOA_CLK_ENABLE(); 00657 __HAL_RCC_GPIOB_CLK_ENABLE(); 00658 __HAL_RCC_GPIOC_CLK_ENABLE(); 00659 __HAL_RCC_GPIOD_CLK_ENABLE(); 00660 00661 /*##-1- Configure peripheral GPIO ##########################################*/ 00662 /* Configure Output for LCD */ 00663 /* Port A */ 00664 gpiopin = LCD_GPIO_BANKA_PINS; 00665 HAL_GPIO_DeInit(GPIOA, gpiopin); 00666 00667 /* Port B */ 00668 gpiopin = LCD_GPIO_BANKB_PINS; 00669 HAL_GPIO_DeInit(GPIOB, gpiopin); 00670 00671 /* Port C*/ 00672 gpiopin = LCD_GPIO_BANKC_PINS; 00673 HAL_GPIO_DeInit(GPIOC, gpiopin); 00674 00675 /* Port D */ 00676 gpiopin = LCD_GPIO_BANKD_PINS; 00677 HAL_GPIO_DeInit(GPIOD, gpiopin); 00678 00679 /*##-5- Enable LCD peripheral Clock ########################################*/ 00680 __HAL_RCC_LCD_CLK_DISABLE(); 00681 } 00682 00683 /** 00684 * @brief Convert an ascii char to the a LCD digit. 00685 * @param Char: a char to display. 00686 * @param Point: a point to add in front of char 00687 * This parameter can be: POINT_OFF or POINT_ON 00688 * @param Colon : flag indicating if a colon character has to be added in front 00689 * of displayed character. 00690 * This parameter can be: DOUBLEPOINT_OFF or DOUBLEPOINT_ON. 00691 * @retval None 00692 */ 00693 static void Convert(uint8_t *Char, Point_Typedef Point, DoublePoint_Typedef Colon) 00694 { 00695 uint16_t ch = 0 ; 00696 uint8_t loop = 0, index = 0; 00697 00698 switch (*Char) 00699 { 00700 case ' ' : 00701 ch = 0x00; 00702 break; 00703 00704 case '*': 00705 ch = C_STAR; 00706 break; 00707 00708 case '(' : 00709 ch = C_OPENPARMAP; 00710 break; 00711 00712 case ')' : 00713 ch = C_CLOSEPARMAP; 00714 break; 00715 00716 case 'd' : 00717 ch = C_DMAP; 00718 break; 00719 00720 case 'm' : 00721 ch = C_MMAP; 00722 break; 00723 00724 case 'n' : 00725 ch = C_NMAP; 00726 break; 00727 00728 case 230 : 00729 ch = C_UMAP; 00730 break; 00731 00732 case '-' : 00733 ch = C_MINUS; 00734 break; 00735 00736 case '+' : 00737 ch = C_PLUS; 00738 break; 00739 00740 case '/' : 00741 ch = C_SLATCH; 00742 break; 00743 00744 case 248 : 00745 ch = C_PERCENT_1; 00746 break; 00747 00748 case '%' : 00749 ch = C_PERCENT_2; 00750 break; 00751 00752 case 255 : 00753 ch = C_FULL; 00754 break ; 00755 00756 case '0': 00757 case '1': 00758 case '2': 00759 case '3': 00760 case '4': 00761 case '5': 00762 case '6': 00763 case '7': 00764 case '8': 00765 case '9': 00766 ch = NumberMap[*Char - ASCII_CHAR_0]; 00767 break; 00768 00769 default: 00770 /* The character Char is one letter in upper case*/ 00771 if ((*Char < ASCII_CHAR_LEFT_OPEN_BRACKET) && (*Char > ASCII_CHAR_AT_SYMBOL)) 00772 { 00773 ch = CapLetterMap[*Char - 'A']; 00774 } 00775 /* The character Char is one letter in lower case*/ 00776 if ((*Char < ASCII_CHAR_LEFT_OPEN_BRACE) && (*Char > ASCII_CHAR_APOSTROPHE)) 00777 { 00778 ch = CapLetterMap[*Char - 'a']; 00779 } 00780 break; 00781 } 00782 00783 /* Set the digital point can be displayed if the point is on */ 00784 if (Point == POINT_ON) 00785 { 00786 ch |= 0x0002; 00787 } 00788 00789 /* Set the "COL" segment in the character that can be displayed if the colon is on */ 00790 if (Colon == DOUBLEPOINT_ON) 00791 { 00792 ch |= 0x0020; 00793 } 00794 00795 for (loop = 12, index = 0 ; index < 4; loop -= 4, index++) 00796 { 00797 Digit[index] = (ch >> loop) & 0x0f; /*To isolate the less significant digit */ 00798 } 00799 } 00800 00801 /** 00802 * @brief Write a character in the LCD frame buffer. 00803 * @param ch: the character to display. 00804 * @param Point: a point to add in front of char 00805 * This parameter can be: POINT_OFF or POINT_ON 00806 * @param Colon: flag indicating if a colon character has to be added in front 00807 * of displayed character. 00808 * This parameter can be: DOUBLEPOINT_OFF or DOUBLEPOINT_ON. 00809 * @param Position: position in the LCD of the character to write [1:6] 00810 * @retval None 00811 */ 00812 static void WriteChar(uint8_t *ch, Point_Typedef Point, DoublePoint_Typedef Colon, DigitPosition_Typedef Position) 00813 { 00814 uint32_t data = 0x00; 00815 /* To convert displayed character in segment in array digit */ 00816 Convert(ch, (Point_Typedef)Point, (DoublePoint_Typedef)Colon); 00817 00818 switch (Position) 00819 { 00820 /* Position 1 on LCD (Digit1)*/ 00821 case LCD_DIGIT_POSITION_1: 00822 data = ((Digit[0] & 0x1) << LCD_SEG0_SHIFT) | (((Digit[0] & 0x2) >> 1) << LCD_SEG1_SHIFT) 00823 | (((Digit[0] & 0x4) >> 2) << LCD_SEG22_SHIFT) | (((Digit[0] & 0x8) >> 3) << LCD_SEG23_SHIFT); 00824 HAL_LCD_Write(&LCDHandle , LCD_DIGIT1_COM0, LCD_DIGIT1_COM0_SEG_MASK, data); /* 1G 1B 1M 1E */ 00825 00826 data = ((Digit[1] & 0x1) << LCD_SEG0_SHIFT) | (((Digit[1] & 0x2) >> 1) << LCD_SEG1_SHIFT) 00827 | (((Digit[1] & 0x4) >> 2) << LCD_SEG22_SHIFT) | (((Digit[1] & 0x8) >> 3) << LCD_SEG23_SHIFT); 00828 HAL_LCD_Write(&LCDHandle , LCD_DIGIT1_COM1, LCD_DIGIT1_COM1_SEG_MASK, data) ; /* 1F 1A 1C 1D */ 00829 00830 data = ((Digit[2] & 0x1) << LCD_SEG0_SHIFT) | (((Digit[2] & 0x2) >> 1) << LCD_SEG1_SHIFT) 00831 | (((Digit[2] & 0x4) >> 2) << LCD_SEG22_SHIFT) | (((Digit[2] & 0x8) >> 3) << LCD_SEG23_SHIFT); 00832 HAL_LCD_Write(&LCDHandle , LCD_DIGIT1_COM2, LCD_DIGIT1_COM2_SEG_MASK, data) ; /* 1Q 1K 1Col 1P */ 00833 00834 data = ((Digit[3] & 0x1) << LCD_SEG0_SHIFT) | (((Digit[3] & 0x2) >> 1) << LCD_SEG1_SHIFT) 00835 | (((Digit[3] & 0x4) >> 2) << LCD_SEG22_SHIFT) | (((Digit[3] & 0x8) >> 3) << LCD_SEG23_SHIFT); 00836 HAL_LCD_Write(&LCDHandle , LCD_DIGIT1_COM3, LCD_DIGIT1_COM3_SEG_MASK, data) ; /* 1H 1J 1DP 1N */ 00837 break; 00838 00839 /* Position 2 on LCD (Digit2)*/ 00840 case LCD_DIGIT_POSITION_2: 00841 data = ((Digit[0] & 0x1) << LCD_SEG2_SHIFT) | (((Digit[0] & 0x2) >> 1) << LCD_SEG3_SHIFT) 00842 | (((Digit[0] & 0x4) >> 2) << LCD_SEG20_SHIFT) | (((Digit[0] & 0x8) >> 3) << LCD_SEG21_SHIFT); 00843 HAL_LCD_Write(&LCDHandle , LCD_DIGIT2_COM0, LCD_DIGIT2_COM0_SEG_MASK, data); /* 1G 1B 1M 1E */ 00844 00845 data = ((Digit[1] & 0x1) << LCD_SEG2_SHIFT) | (((Digit[1] & 0x2) >> 1) << LCD_SEG3_SHIFT) 00846 | (((Digit[1] & 0x4) >> 2) << LCD_SEG20_SHIFT) | (((Digit[1] & 0x8) >> 3) << LCD_SEG21_SHIFT); 00847 HAL_LCD_Write(&LCDHandle , LCD_DIGIT2_COM1, LCD_DIGIT2_COM1_SEG_MASK, data) ; /* 1F 1A 1C 1D */ 00848 00849 data = ((Digit[2] & 0x1) << LCD_SEG2_SHIFT) | (((Digit[2] & 0x2) >> 1) << LCD_SEG3_SHIFT) 00850 | (((Digit[2] & 0x4) >> 2) << LCD_SEG20_SHIFT) | (((Digit[2] & 0x8) >> 3) << LCD_SEG21_SHIFT); 00851 HAL_LCD_Write(&LCDHandle , LCD_DIGIT2_COM2, LCD_DIGIT2_COM2_SEG_MASK, data) ; /* 1Q 1K 1Col 1P */ 00852 00853 data = ((Digit[3] & 0x1) << LCD_SEG2_SHIFT) | (((Digit[3] & 0x2) >> 1) << LCD_SEG3_SHIFT) 00854 | (((Digit[3] & 0x4) >> 2) << LCD_SEG20_SHIFT) | (((Digit[3] & 0x8) >> 3) << LCD_SEG21_SHIFT); 00855 HAL_LCD_Write(&LCDHandle , LCD_DIGIT2_COM3, LCD_DIGIT2_COM3_SEG_MASK, data) ; /* 1H 1J 1DP 1N */ 00856 break; 00857 00858 /* Position 3 on LCD (Digit3)*/ 00859 case LCD_DIGIT_POSITION_3: 00860 data = ((Digit[0] & 0x1) << LCD_SEG4_SHIFT) | (((Digit[0] & 0x2) >> 1) << LCD_SEG5_SHIFT) 00861 | (((Digit[0] & 0x4) >> 2) << LCD_SEG18_SHIFT) | (((Digit[0] & 0x8) >> 3) << LCD_SEG19_SHIFT); 00862 HAL_LCD_Write(&LCDHandle , LCD_DIGIT3_COM0, LCD_DIGIT3_COM0_SEG_MASK, data); /* 1G 1B 1M 1E */ 00863 00864 data = ((Digit[1] & 0x1) << LCD_SEG4_SHIFT) | (((Digit[1] & 0x2) >> 1) << LCD_SEG5_SHIFT) 00865 | (((Digit[1] & 0x4) >> 2) << LCD_SEG18_SHIFT) | (((Digit[1] & 0x8) >> 3) << LCD_SEG19_SHIFT); 00866 HAL_LCD_Write(&LCDHandle , LCD_DIGIT3_COM1, LCD_DIGIT3_COM1_SEG_MASK, data) ; /* 1F 1A 1C 1D */ 00867 00868 data = ((Digit[2] & 0x1) << LCD_SEG4_SHIFT) | (((Digit[2] & 0x2) >> 1) << LCD_SEG5_SHIFT) 00869 | (((Digit[2] & 0x4) >> 2) << LCD_SEG18_SHIFT) | (((Digit[2] & 0x8) >> 3) << LCD_SEG19_SHIFT); 00870 HAL_LCD_Write(&LCDHandle , LCD_DIGIT3_COM2, LCD_DIGIT3_COM2_SEG_MASK, data) ; /* 1Q 1K 1Col 1P */ 00871 00872 data = ((Digit[3] & 0x1) << LCD_SEG4_SHIFT) | (((Digit[3] & 0x2) >> 1) << LCD_SEG5_SHIFT) 00873 | (((Digit[3] & 0x4) >> 2) << LCD_SEG18_SHIFT) | (((Digit[3] & 0x8) >> 3) << LCD_SEG19_SHIFT); 00874 HAL_LCD_Write(&LCDHandle , LCD_DIGIT3_COM3, LCD_DIGIT3_COM3_SEG_MASK, data) ; /* 1H 1J 1DP 1N */ 00875 break; 00876 00877 /* Position 4 on LCD (Digit4)*/ 00878 case LCD_DIGIT_POSITION_4: 00879 data = ((Digit[0] & 0x1) << LCD_SEG6_SHIFT) | (((Digit[0] & 0x8) >> 3) << LCD_SEG17_SHIFT); 00880 HAL_LCD_Write(&LCDHandle , LCD_DIGIT4_COM0, LCD_DIGIT4_COM0_SEG_MASK, data); /* 1G 1B 1M 1E */ 00881 00882 data = (((Digit[0] & 0x2) >> 1) << LCD_SEG7_SHIFT) | (((Digit[0] & 0x4) >> 2) << LCD_SEG16_SHIFT); 00883 HAL_LCD_Write(&LCDHandle , LCD_DIGIT4_COM0_1, LCD_DIGIT4_COM0_1_SEG_MASK, data); /* 1G 1B 1M 1E */ 00884 00885 data = ((Digit[1] & 0x1) << LCD_SEG6_SHIFT) | (((Digit[1] & 0x8) >> 3) << LCD_SEG17_SHIFT); 00886 HAL_LCD_Write(&LCDHandle , LCD_DIGIT4_COM1, LCD_DIGIT4_COM1_SEG_MASK, data) ; /* 1F 1A 1C 1D */ 00887 00888 data = (((Digit[1] & 0x2) >> 1) << LCD_SEG7_SHIFT) | (((Digit[1] & 0x4) >> 2) << LCD_SEG16_SHIFT); 00889 HAL_LCD_Write(&LCDHandle , LCD_DIGIT4_COM1_1, LCD_DIGIT4_COM1_1_SEG_MASK, data) ; /* 1F 1A 1C 1D */ 00890 00891 data = ((Digit[2] & 0x1) << LCD_SEG6_SHIFT) | (((Digit[2] & 0x8) >> 3) << LCD_SEG17_SHIFT); 00892 HAL_LCD_Write(&LCDHandle , LCD_DIGIT4_COM2, LCD_DIGIT4_COM2_SEG_MASK, data) ; /* 1Q 1K 1Col 1P */ 00893 00894 data = (((Digit[2] & 0x2) >> 1) << LCD_SEG7_SHIFT) | (((Digit[2] & 0x4) >> 2) << LCD_SEG16_SHIFT); 00895 HAL_LCD_Write(&LCDHandle , LCD_DIGIT4_COM2_1, LCD_DIGIT4_COM2_1_SEG_MASK, data) ; /* 1Q 1K 1Col 1P */ 00896 00897 data = ((Digit[3] & 0x1) << LCD_SEG6_SHIFT) | (((Digit[3] & 0x8) >> 3) << LCD_SEG17_SHIFT); 00898 HAL_LCD_Write(&LCDHandle , LCD_DIGIT4_COM3, LCD_DIGIT4_COM3_SEG_MASK, data) ; /* 1H 1J 1DP 1N */ 00899 00900 data = (((Digit[3] & 0x2) >> 1) << LCD_SEG7_SHIFT) | (((Digit[3] & 0x4) >> 2) << LCD_SEG16_SHIFT); 00901 HAL_LCD_Write(&LCDHandle , LCD_DIGIT4_COM3_1, LCD_DIGIT4_COM3_1_SEG_MASK, data) ; /* 1H 1J 1DP 1N */ 00902 break; 00903 00904 /* Position 5 on LCD (Digit5)*/ 00905 case LCD_DIGIT_POSITION_5: 00906 data = (((Digit[0] & 0x2) >> 1) << LCD_SEG9_SHIFT) | (((Digit[0] & 0x4) >> 2) << LCD_SEG14_SHIFT); 00907 HAL_LCD_Write(&LCDHandle , LCD_DIGIT5_COM0, LCD_DIGIT5_COM0_SEG_MASK, data); /* 1G 1B 1M 1E */ 00908 00909 data = ((Digit[0] & 0x1) << LCD_SEG8_SHIFT) | (((Digit[0] & 0x8) >> 3) << LCD_SEG15_SHIFT); 00910 HAL_LCD_Write(&LCDHandle , LCD_DIGIT5_COM0_1, LCD_DIGIT5_COM0_1_SEG_MASK, data); /* 1G 1B 1M 1E */ 00911 00912 data = (((Digit[1] & 0x2) >> 1) << LCD_SEG9_SHIFT) | (((Digit[1] & 0x4) >> 2) << LCD_SEG14_SHIFT); 00913 HAL_LCD_Write(&LCDHandle , LCD_DIGIT5_COM1, LCD_DIGIT5_COM1_SEG_MASK, data) ; /* 1F 1A 1C 1D */ 00914 00915 data = ((Digit[1] & 0x1) << LCD_SEG8_SHIFT) | (((Digit[1] & 0x8) >> 3) << LCD_SEG15_SHIFT); 00916 HAL_LCD_Write(&LCDHandle , LCD_DIGIT5_COM1_1, LCD_DIGIT5_COM1_1_SEG_MASK, data) ; /* 1F 1A 1C 1D */ 00917 00918 data = (((Digit[2] & 0x2) >> 1) << LCD_SEG9_SHIFT) | (((Digit[2] & 0x4) >> 2) << LCD_SEG14_SHIFT); 00919 HAL_LCD_Write(&LCDHandle , LCD_DIGIT5_COM2, LCD_DIGIT5_COM2_SEG_MASK, data) ; /* 1Q 1K 1Col 1P */ 00920 00921 data = ((Digit[2] & 0x1) << LCD_SEG8_SHIFT) | (((Digit[2] & 0x8) >> 3) << LCD_SEG15_SHIFT); 00922 HAL_LCD_Write(&LCDHandle , LCD_DIGIT5_COM2_1, LCD_DIGIT5_COM2_1_SEG_MASK, data) ; /* 1Q 1K 1Col 1P */ 00923 00924 data = (((Digit[3] & 0x2) >> 1) << LCD_SEG9_SHIFT) | (((Digit[3] & 0x4) >> 2) << LCD_SEG14_SHIFT); 00925 HAL_LCD_Write(&LCDHandle , LCD_DIGIT5_COM3, LCD_DIGIT5_COM3_SEG_MASK, data) ; /* 1H 1J 1DP 1N */ 00926 00927 data = ((Digit[3] & 0x1) << LCD_SEG8_SHIFT) | (((Digit[3] & 0x8) >> 3) << LCD_SEG15_SHIFT); 00928 HAL_LCD_Write(&LCDHandle , LCD_DIGIT5_COM3_1, LCD_DIGIT5_COM3_1_SEG_MASK, data) ; /* 1H 1J 1DP 1N */ 00929 break; 00930 00931 /* Position 6 on LCD (Digit6)*/ 00932 case LCD_DIGIT_POSITION_6: 00933 data = ((Digit[0] & 0x1) << LCD_SEG10_SHIFT) | (((Digit[0] & 0x2) >> 1) << LCD_SEG11_SHIFT) 00934 | (((Digit[0] & 0x4) >> 2) << LCD_SEG12_SHIFT) | (((Digit[0] & 0x8) >> 3) << LCD_SEG13_SHIFT); 00935 HAL_LCD_Write(&LCDHandle , LCD_DIGIT6_COM0, LCD_DIGIT6_COM0_SEG_MASK, data); /* 1G 1B 1M 1E */ 00936 00937 data = ((Digit[1] & 0x1) << LCD_SEG10_SHIFT) | (((Digit[1] & 0x2) >> 1) << LCD_SEG11_SHIFT) 00938 | (((Digit[1] & 0x4) >> 2) << LCD_SEG12_SHIFT) | (((Digit[1] & 0x8) >> 3) << LCD_SEG13_SHIFT); 00939 HAL_LCD_Write(&LCDHandle , LCD_DIGIT6_COM1, LCD_DIGIT6_COM1_SEG_MASK, data) ; /* 1F 1A 1C 1D */ 00940 00941 data = ((Digit[2] & 0x1) << LCD_SEG10_SHIFT) | (((Digit[2] & 0x2) >> 1) << LCD_SEG11_SHIFT) 00942 | (((Digit[2] & 0x4) >> 2) << LCD_SEG12_SHIFT) | (((Digit[2] & 0x8) >> 3) << LCD_SEG13_SHIFT); 00943 HAL_LCD_Write(&LCDHandle , LCD_DIGIT6_COM2, LCD_DIGIT6_COM2_SEG_MASK, data) ; /* 1Q 1K 1Col 1P */ 00944 00945 data = ((Digit[3] & 0x1) << LCD_SEG10_SHIFT) | (((Digit[3] & 0x2) >> 1) << LCD_SEG11_SHIFT) 00946 | (((Digit[3] & 0x4) >> 2) << LCD_SEG12_SHIFT) | (((Digit[3] & 0x8) >> 3) << LCD_SEG13_SHIFT); 00947 HAL_LCD_Write(&LCDHandle , LCD_DIGIT6_COM3, LCD_DIGIT6_COM3_SEG_MASK, data) ; /* 1H 1J 1DP 1N */ 00948 break; 00949 00950 default: 00951 break; 00952 } 00953 } 00954 00955 /** 00956 * @} 00957 */ 00958 00959 /** 00960 * @} 00961 */ 00962 00963 /** 00964 * @} 00965 */ 00966 00967 /** 00968 * @} 00969 */ 00970 00971 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Wed Aug 17 2022 15:47:40 by
