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