STM32L4xx_HAL_Driver  1.14.0

LCD RAM functions. More...

Functions

HAL_StatusTypeDef HAL_LCD_Write (LCD_HandleTypeDef *hlcd, uint32_t RAMRegisterIndex, uint32_t RAMRegisterMask, uint32_t Data)
 Write a word in the specific LCD RAM. More...
 
HAL_StatusTypeDef HAL_LCD_Clear (LCD_HandleTypeDef *hlcd)
 Clear the LCD RAM registers. More...
 
HAL_StatusTypeDef HAL_LCD_UpdateDisplayRequest (LCD_HandleTypeDef *hlcd)
 Enable the Update Display Request. More...
 

Detailed Description

LCD RAM functions.

 ===============================================================================
                      ##### IO operation functions #####
 ===============================================================================
 [..] Using its double buffer memory the LCD controller ensures the coherency of the
 displayed information without having to use interrupts to control LCD_RAM
 modification.
 The application software can access the first buffer level (LCD_RAM) through
 the APB interface. Once it has modified the LCD_RAM using the HAL_LCD_Write() API,
 it sets the UDR flag in the LCD_SR register using the HAL_LCD_UpdateDisplayRequest() API.
 This UDR flag (update display request) requests the updated information to be
 moved into the second buffer level (LCD_DISPLAY).
 This operation is done synchronously with the frame (at the beginning of the
 next frame), until the update is completed, the LCD_RAM is write protected and
 the UDR flag stays high.
 Once the update is completed another flag (UDD - Update Display Done) is set and
 generates an interrupt if the UDDIE bit in the LCD_FCR register is set.
 The time it takes to update LCD_DISPLAY is, in the worst case, one odd and one
 even frame.
 The update will not occur (UDR = 1 and UDD = 0) until the display is
 enabled (LCDEN = 1).

Function Documentation

◆ HAL_LCD_Clear()

HAL_StatusTypeDef HAL_LCD_Clear ( LCD_HandleTypeDef hlcd)

Clear the LCD RAM registers.

Parameters
hlcdLCD handle
Return values
None

< Wait Until the LCD is ready

Definition at line 425 of file stm32l4xx_hal_lcd.c.

426 {
427  uint32_t tickstart;
428  uint32_t counter;
429  HAL_StatusTypeDef status = HAL_ERROR;
430  HAL_LCD_StateTypeDef state = hlcd->State;
431 
432  if ((state == HAL_LCD_STATE_READY) || (state == HAL_LCD_STATE_BUSY))
433  {
434  /* Process Locked */
435  __HAL_LOCK(hlcd);
436 
437  hlcd->State = HAL_LCD_STATE_BUSY;
438 
439  /* Get timeout */
440  tickstart = HAL_GetTick();
441 
443  while (__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDR) != RESET)
444  {
445  if ((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
446  {
447  hlcd->ErrorCode = HAL_LCD_ERROR_UDR;
448 
449  /* Process Unlocked */
450  __HAL_UNLOCK(hlcd);
451 
452  return HAL_TIMEOUT;
453  }
454  }
455  /* Clear the LCD_RAM registers */
456  for (counter = LCD_RAM_REGISTER0; counter <= LCD_RAM_REGISTER15; counter++)
457  {
458  hlcd->Instance->RAM[counter] = 0;
459  }
460 
461  /* Update the LCD display */
462  status = HAL_LCD_UpdateDisplayRequest(hlcd);
463  }
464  return status;
465 }
HAL_LCD_StateTypeDef
HAL LCD State structures definition.
__IO HAL_LCD_StateTypeDef State
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
__IO uint32_t ErrorCode
LCD_TypeDef * Instance
HAL_StatusTypeDef HAL_LCD_UpdateDisplayRequest(LCD_HandleTypeDef *hlcd)
Enable the Update Display Request.

◆ HAL_LCD_UpdateDisplayRequest()

HAL_StatusTypeDef HAL_LCD_UpdateDisplayRequest ( LCD_HandleTypeDef hlcd)

Enable the Update Display Request.

Parameters
hlcdLCD handle
Note
Each time software modifies the LCD_RAM it must set the UDR bit to transfer the updated data to the second level buffer. The UDR bit stays set until the end of the update and during this time the LCD_RAM is write protected.
When the display is disabled, the update is performed for all LCD_DISPLAY locations. When the display is enabled, the update is performed only for locations for which commons are active (depending on DUTY). For example if DUTY = 1/2, only the LCD_DISPLAY of COM0 and COM1 will be updated.
Return values
None

< Wait Until the LCD display is done

Definition at line 481 of file stm32l4xx_hal_lcd.c.

482 {
483  uint32_t tickstart;
484 
485  /* Clear the Update Display Done flag before starting the update display request */
486  __HAL_LCD_CLEAR_FLAG(hlcd, LCD_FLAG_UDD);
487 
488  /* Enable the display request */
489  hlcd->Instance->SR |= LCD_SR_UDR;
490 
491  /* Get timeout */
492  tickstart = HAL_GetTick();
493 
495  while (__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDD) == RESET)
496  {
497  if ((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
498  {
499  hlcd->ErrorCode = HAL_LCD_ERROR_UDD;
500 
501  /* Process Unlocked */
502  __HAL_UNLOCK(hlcd);
503 
504  return HAL_TIMEOUT;
505  }
506  }
507 
508  hlcd->State = HAL_LCD_STATE_READY;
509 
510  /* Process Unlocked */
511  __HAL_UNLOCK(hlcd);
512 
513  return HAL_OK;
514 }
__IO HAL_LCD_StateTypeDef State
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
return HAL_OK
__IO uint32_t ErrorCode
LCD_TypeDef * Instance

◆ HAL_LCD_Write()

HAL_StatusTypeDef HAL_LCD_Write ( LCD_HandleTypeDef hlcd,
uint32_t  RAMRegisterIndex,
uint32_t  RAMRegisterMask,
uint32_t  Data 
)

Write a word in the specific LCD RAM.

Parameters
hlcdLCD handle
RAMRegisterIndexspecifies the LCD RAM Register. This parameter can be one of the following values:
  • LCD_RAM_REGISTER0: LCD RAM Register 0
  • LCD_RAM_REGISTER1: LCD RAM Register 1
  • LCD_RAM_REGISTER2: LCD RAM Register 2
  • LCD_RAM_REGISTER3: LCD RAM Register 3
  • LCD_RAM_REGISTER4: LCD RAM Register 4
  • LCD_RAM_REGISTER5: LCD RAM Register 5
  • LCD_RAM_REGISTER6: LCD RAM Register 6
  • LCD_RAM_REGISTER7: LCD RAM Register 7
  • LCD_RAM_REGISTER8: LCD RAM Register 8
  • LCD_RAM_REGISTER9: LCD RAM Register 9
  • LCD_RAM_REGISTER10: LCD RAM Register 10
  • LCD_RAM_REGISTER11: LCD RAM Register 11
  • LCD_RAM_REGISTER12: LCD RAM Register 12
  • LCD_RAM_REGISTER13: LCD RAM Register 13
  • LCD_RAM_REGISTER14: LCD RAM Register 14
  • LCD_RAM_REGISTER15: LCD RAM Register 15
RAMRegisterMaskspecifies the LCD RAM Register Data Mask.
Dataspecifies LCD Data Value to be written.
Return values
None

< Wait Until the LCD is ready

Definition at line 375 of file stm32l4xx_hal_lcd.c.

376 {
377  uint32_t tickstart;
378  HAL_LCD_StateTypeDef state = hlcd->State;
379 
380  if ((state == HAL_LCD_STATE_READY) || (state == HAL_LCD_STATE_BUSY))
381  {
382  /* Check the parameters */
383  assert_param(IS_LCD_RAM_REGISTER(RAMRegisterIndex));
384 
385  if (hlcd->State == HAL_LCD_STATE_READY)
386  {
387  /* Process Locked */
388  __HAL_LOCK(hlcd);
389  hlcd->State = HAL_LCD_STATE_BUSY;
390 
391  /* Get timeout */
392  tickstart = HAL_GetTick();
393 
395  while (__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDR) != RESET)
396  {
397  if ((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
398  {
399  hlcd->ErrorCode = HAL_LCD_ERROR_UDR;
400 
401  /* Process Unlocked */
402  __HAL_UNLOCK(hlcd);
403 
404  return HAL_TIMEOUT;
405  }
406  }
407  }
408 
409  /* Copy the new Data bytes to LCD RAM register */
410  MODIFY_REG(hlcd->Instance->RAM[RAMRegisterIndex], ~(RAMRegisterMask), Data);
411 
412  return HAL_OK;
413  }
414  else
415  {
416  return HAL_ERROR;
417  }
418 }
HAL_LCD_StateTypeDef
HAL LCD State structures definition.
__IO HAL_LCD_StateTypeDef State
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
__IO uint32_t ErrorCode
LCD_TypeDef * Instance
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))