|
发表于 2016-5-18 14:29:41
|
显示全部楼层
//------------------------自定义调色板,从LCDP1.c拷贝-------------------------------------------
static unsigned int User_LCDDEV_Color2Index (LCD_COLOR Color)
{
int r,g,b;
r = Color &255;
g = (Color>>8) &255;
b = Color>>16;
return (r+g+b+300) /(3*255) ? 0 : 1;
}
static LCD_COLOR User_LCDDEV_Index2Color (unsigned Index)
{
return Index ? 0 : 0xFFFFFF;
}
static unsigned int User_LCDDEV_GetIndexMask (void)
{
return 0x01;
}
static void User_LCDDEV_Color2IndexBulk(LCD_COLOR * pColor, void * pIndex, U32 NumItems, U8 SizeOfIndex)
{
}
static void User_LCDDEV_Index2ColorBulk(void * pIndex, LCD_COLOR * pColor, U32 NumItems, U8 SizeOfIndex)
{
}
const LCD_API_COLOR_CONV LCD_API_ColorConv_User = {
User_LCDDEV_Color2Index ,
User_LCDDEV_Index2Color ,
User_LCDDEV_GetIndexMask ,
0 ,
User_LCDDEV_Color2IndexBulk ,
User_LCDDEV_Index2ColorBulk
};
//-----------------------------------------------------------------------------------
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* LCD_X_Config
*
* Purpose:
* Called during the initialization process in order to set up the
* display driver configuration.
*
*/
void LCD_X_Config(void) {
//
// Set display driver and color conversion for 1st layer
//
GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, /*COLOR_CONVERSION*/&LCD_API_ColorConv_User, 0, 0);
//
// Display driver configuration, required for Lin-driver
//
LCD_SetSizeEx (0, XSIZE_PHYS, YSIZE_PHYS);
LCD_SetVSizeEx (0, VXSIZE_PHYS, VYSIZE_PHYS);
LCD_SetVRAMAddrEx(0, (void *)VRAM_ADDR);
//
// Set user palette data (only required if no fixed palette is used)
//
#if defined(PALETTE)
LCD_SetLUTEx(0, PALETTE);
#endif
} |
|