// Note modifed by CMN to use X as a coordinate, not a character position
void BSP_LCD_DisplayStringAt(uint16_t X, uint16_t Y, uint8_t *pText, Text_AlignModeTypdef mode)
{
  uint32_t fgColor;
  uint32_t bgColor;

  fgColor = BSP_LCD_GetTextColor();
  bgColor = BSP_LCD_GetBackColor();


  uint16_t refcolumn = 1, i = 0;
  uint32_t size = 0, xsize = 0; 
  uint8_t  *ptr = pText;
  
  /* Get the text size */
  while (*ptr++) size ++ ;
  
  /* Characters number per line */
  xsize = (BSP_LCD_GetXSize()/DrawProp[ActiveLayer].pFont->Width);
  
  switch (mode)
  {
  case CENTER_MODE:
    {
      refcolumn = X - ((size)* DrawProp[ActiveLayer].pFont->Width) / 2;
      break;
    }
  case LEFT_MODE:
    {
      refcolumn = X;
      break;
    }
  case RIGHT_MODE:
    {
      refcolumn = X + ((xsize - size)*DrawProp[ActiveLayer].pFont->Width);
      break;
    }
  default:
    {
      refcolumn = X;
      break;
    }
  }

  /* Send the string character by character on LCD */
  while ((*pText != 0) & (((BSP_LCD_GetXSize() - (i*DrawProp[ActiveLayer].pFont->Width)) & 0xFFFF) >= DrawProp[ActiveLayer].pFont->Width))
  {
    // inverse video
    if (*pText & 0x80)
    {
      BSP_LCD_SetTextColor(bgColor);
      BSP_LCD_SetBackColor(fgColor);
    }
    else
    {
      BSP_LCD_SetTextColor(fgColor);
      BSP_LCD_SetBackColor(bgColor);
    }
    /* Display one character on LCD */
    BSP_LCD_DisplayChar(refcolumn, Y, 0x7f & (*pText));
    /* Decrement the column position by 16 */
    refcolumn += DrawProp[ActiveLayer].pFont->Width;
    /* Point on the next character */
    pText++;
    i++;
  }  
}
Ejemplo n.º 2
0
uint32_t LCD_DISCO_F469NI::GetBackColor(void)
{
  return BSP_LCD_GetBackColor();
}