AnsweredAssumed Answered

Bug in Chip_LCD_Init() in lcd_17xx_40xx.c?

Question asked by Giuseppe Modugno on Feb 16, 2018
Latest reply on Feb 16, 2018 by soledad

void Chip_LCD_Init(LPC_LCD_T *pLCD, LCD_CONFIG_T *LCD_ConfigStruct)
{

   /* ... */

   /* set bits per pixel */
   regValue = LCD_ConfigStruct->BPP << 1;

   /* set color format RGB */
   regValue |= LCD_ConfigStruct->color_format << 8;
   regValue |= LCD_ConfigStruct->LCD << 4;
   if (LCD_ConfigStruct->Dual == 1) {
      regValue |= 1 << 7;
   }
   pLCD->CTRL = regValue;

   /* ... */

}

 

The field BPP (CTRL[3:1]) is: 0=1bpp, 1=2bpp, 2=4bpp, 3=8bpp, 4=16bpp, 5=24bpp, 6=16bpp, 7=12bpp. So you need to assign the value 5 (if you need 24bpp) to the BPP field of LCD_CONFIG_T struct. However this is not clear and it seems you can assign directly 24 to BPP. Maybe an enumeration is better in this case.

Outcomes