rt-thread/bsp/x1000/drivers/slcd/drv_slcd_rm68120.c

537 lines
25 KiB
C

/*
* File : slcd_rm68120.c
* COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team
*
* Change Logs:
* Date Author Notes
* 2017Äê4ÔÂ11ÈÕ Urey the first version
*/
#include <rtthread.h>
#include <cache.h>
#include "board.h"
#include "drv_slcdc.h"
#include <drv_gpio.h>
#ifdef RT_USING_RM68120
rt_uint32_t _rm68120_cmd_table[]=
{
0x002c002c,
};
const struct slcd_data_table _rm68120_data_table[] =
{
//ENABLE PAGE 1
{SMART_CONFIG_CMD,0xF000},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xF001},{SMART_CONFIG_DATA,0xAA},
{SMART_CONFIG_CMD,0xF002},{SMART_CONFIG_DATA,0x52},
{SMART_CONFIG_CMD,0xF003},{SMART_CONFIG_DATA,0x08},
{SMART_CONFIG_CMD,0xF004},{SMART_CONFIG_DATA,0x01},
//GAMMA SETING RED
{SMART_CONFIG_CMD,0xD100},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD101},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD102},{SMART_CONFIG_DATA,0x1b},
{SMART_CONFIG_CMD,0xD103},{SMART_CONFIG_DATA,0x44},
{SMART_CONFIG_CMD,0xD104},{SMART_CONFIG_DATA,0x62},
{SMART_CONFIG_CMD,0xD105},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD106},{SMART_CONFIG_DATA,0x7b},
{SMART_CONFIG_CMD,0xD107},{SMART_CONFIG_DATA,0xa1},
{SMART_CONFIG_CMD,0xD108},{SMART_CONFIG_DATA,0xc0},
{SMART_CONFIG_CMD,0xD109},{SMART_CONFIG_DATA,0xee},
{SMART_CONFIG_CMD,0xD10A},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD10B},{SMART_CONFIG_DATA,0x10},
{SMART_CONFIG_CMD,0xD10C},{SMART_CONFIG_DATA,0x2c},
{SMART_CONFIG_CMD,0xD10D},{SMART_CONFIG_DATA,0x43},
{SMART_CONFIG_CMD,0xD10E},{SMART_CONFIG_DATA,0x57},
{SMART_CONFIG_CMD,0xD10F},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD110},{SMART_CONFIG_DATA,0x68},
{SMART_CONFIG_CMD,0xD111},{SMART_CONFIG_DATA,0x78},
{SMART_CONFIG_CMD,0xD112},{SMART_CONFIG_DATA,0x87},
{SMART_CONFIG_CMD,0xD113},{SMART_CONFIG_DATA,0x94},
{SMART_CONFIG_CMD,0xD114},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD115},{SMART_CONFIG_DATA,0xa0},
{SMART_CONFIG_CMD,0xD116},{SMART_CONFIG_DATA,0xac},
{SMART_CONFIG_CMD,0xD117},{SMART_CONFIG_DATA,0xb6},
{SMART_CONFIG_CMD,0xD118},{SMART_CONFIG_DATA,0xc1},
{SMART_CONFIG_CMD,0xD119},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD11A},{SMART_CONFIG_DATA,0xcb},
{SMART_CONFIG_CMD,0xD11B},{SMART_CONFIG_DATA,0xcd},
{SMART_CONFIG_CMD,0xD11C},{SMART_CONFIG_DATA,0xd6},
{SMART_CONFIG_CMD,0xD11D},{SMART_CONFIG_DATA,0xdf},
{SMART_CONFIG_CMD,0xD11E},{SMART_CONFIG_DATA,0x95},
{SMART_CONFIG_CMD,0xD11F},{SMART_CONFIG_DATA,0xe8},
{SMART_CONFIG_CMD,0xD120},{SMART_CONFIG_DATA,0xf1},
{SMART_CONFIG_CMD,0xD121},{SMART_CONFIG_DATA,0xfa},
{SMART_CONFIG_CMD,0xD122},{SMART_CONFIG_DATA,0x02},
{SMART_CONFIG_CMD,0xD123},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD124},{SMART_CONFIG_DATA,0x0b},
{SMART_CONFIG_CMD,0xD125},{SMART_CONFIG_DATA,0x13},
{SMART_CONFIG_CMD,0xD126},{SMART_CONFIG_DATA,0x1d},
{SMART_CONFIG_CMD,0xD127},{SMART_CONFIG_DATA,0x26},
{SMART_CONFIG_CMD,0xD128},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD129},{SMART_CONFIG_DATA,0x30},
{SMART_CONFIG_CMD,0xD12A},{SMART_CONFIG_DATA,0x3c},
{SMART_CONFIG_CMD,0xD12B},{SMART_CONFIG_DATA,0x4A},
{SMART_CONFIG_CMD,0xD12C},{SMART_CONFIG_DATA,0x63},
{SMART_CONFIG_CMD,0xD12D},{SMART_CONFIG_DATA,0xea},
{SMART_CONFIG_CMD,0xD12E},{SMART_CONFIG_DATA,0x79},
{SMART_CONFIG_CMD,0xD12F},{SMART_CONFIG_DATA,0xa6},
{SMART_CONFIG_CMD,0xD130},{SMART_CONFIG_DATA,0xd0},
{SMART_CONFIG_CMD,0xD131},{SMART_CONFIG_DATA,0x20},
{SMART_CONFIG_CMD,0xD132},{SMART_CONFIG_DATA,0x0f},
{SMART_CONFIG_CMD,0xD133},{SMART_CONFIG_DATA,0x8e},
{SMART_CONFIG_CMD,0xD134},{SMART_CONFIG_DATA,0xff},
//GAMMA SETING GREEN
{SMART_CONFIG_CMD,0xD200},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD201},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD202},{SMART_CONFIG_DATA,0x1b},
{SMART_CONFIG_CMD,0xD203},{SMART_CONFIG_DATA,0x44},
{SMART_CONFIG_CMD,0xD204},{SMART_CONFIG_DATA,0x62},
{SMART_CONFIG_CMD,0xD205},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD206},{SMART_CONFIG_DATA,0x7b},
{SMART_CONFIG_CMD,0xD207},{SMART_CONFIG_DATA,0xa1},
{SMART_CONFIG_CMD,0xD208},{SMART_CONFIG_DATA,0xc0},
{SMART_CONFIG_CMD,0xD209},{SMART_CONFIG_DATA,0xee},
{SMART_CONFIG_CMD,0xD20A},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD20B},{SMART_CONFIG_DATA,0x10},
{SMART_CONFIG_CMD,0xD20C},{SMART_CONFIG_DATA,0x2c},
{SMART_CONFIG_CMD,0xD20D},{SMART_CONFIG_DATA,0x43},
{SMART_CONFIG_CMD,0xD20E},{SMART_CONFIG_DATA,0x57},
{SMART_CONFIG_CMD,0xD20F},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD210},{SMART_CONFIG_DATA,0x68},
{SMART_CONFIG_CMD,0xD211},{SMART_CONFIG_DATA,0x78},
{SMART_CONFIG_CMD,0xD212},{SMART_CONFIG_DATA,0x87},
{SMART_CONFIG_CMD,0xD213},{SMART_CONFIG_DATA,0x94},
{SMART_CONFIG_CMD,0xD214},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD215},{SMART_CONFIG_DATA,0xa0},
{SMART_CONFIG_CMD,0xD216},{SMART_CONFIG_DATA,0xac},
{SMART_CONFIG_CMD,0xD217},{SMART_CONFIG_DATA,0xb6},
{SMART_CONFIG_CMD,0xD218},{SMART_CONFIG_DATA,0xc1},
{SMART_CONFIG_CMD,0xD219},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD21A},{SMART_CONFIG_DATA,0xcb},
{SMART_CONFIG_CMD,0xD21B},{SMART_CONFIG_DATA,0xcd},
{SMART_CONFIG_CMD,0xD21C},{SMART_CONFIG_DATA,0xd6},
{SMART_CONFIG_CMD,0xD21D},{SMART_CONFIG_DATA,0xdf},
{SMART_CONFIG_CMD,0xD21E},{SMART_CONFIG_DATA,0x95},
{SMART_CONFIG_CMD,0xD21F},{SMART_CONFIG_DATA,0xe8},
{SMART_CONFIG_CMD,0xD220},{SMART_CONFIG_DATA,0xf1},
{SMART_CONFIG_CMD,0xD221},{SMART_CONFIG_DATA,0xfa},
{SMART_CONFIG_CMD,0xD222},{SMART_CONFIG_DATA,0x02},
{SMART_CONFIG_CMD,0xD223},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD224},{SMART_CONFIG_DATA,0x0b},
{SMART_CONFIG_CMD,0xD225},{SMART_CONFIG_DATA,0x13},
{SMART_CONFIG_CMD,0xD226},{SMART_CONFIG_DATA,0x1d},
{SMART_CONFIG_CMD,0xD227},{SMART_CONFIG_DATA,0x26},
{SMART_CONFIG_CMD,0xD228},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD229},{SMART_CONFIG_DATA,0x30},
{SMART_CONFIG_CMD,0xD22A},{SMART_CONFIG_DATA,0x3c},
{SMART_CONFIG_CMD,0xD22B},{SMART_CONFIG_DATA,0x4a},
{SMART_CONFIG_CMD,0xD22C},{SMART_CONFIG_DATA,0x63},
{SMART_CONFIG_CMD,0xD22D},{SMART_CONFIG_DATA,0xea},
{SMART_CONFIG_CMD,0xD22E},{SMART_CONFIG_DATA,0x79},
{SMART_CONFIG_CMD,0xD22F},{SMART_CONFIG_DATA,0xa6},
{SMART_CONFIG_CMD,0xD230},{SMART_CONFIG_DATA,0xd0},
{SMART_CONFIG_CMD,0xD231},{SMART_CONFIG_DATA,0x20},
{SMART_CONFIG_CMD,0xD232},{SMART_CONFIG_DATA,0x0f},
{SMART_CONFIG_CMD,0xD233},{SMART_CONFIG_DATA,0x8e},
{SMART_CONFIG_CMD,0xD234},{SMART_CONFIG_DATA,0xff},
//GAMMA SETING BLUE
{SMART_CONFIG_CMD,0xD300},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD301},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD302},{SMART_CONFIG_DATA,0x1b},
{SMART_CONFIG_CMD,0xD303},{SMART_CONFIG_DATA,0x44},
{SMART_CONFIG_CMD,0xD304},{SMART_CONFIG_DATA,0x62},
{SMART_CONFIG_CMD,0xD305},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD306},{SMART_CONFIG_DATA,0x7b},
{SMART_CONFIG_CMD,0xD307},{SMART_CONFIG_DATA,0xa1},
{SMART_CONFIG_CMD,0xD308},{SMART_CONFIG_DATA,0xc0},
{SMART_CONFIG_CMD,0xD309},{SMART_CONFIG_DATA,0xee},
{SMART_CONFIG_CMD,0xD30A},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD30B},{SMART_CONFIG_DATA,0x10},
{SMART_CONFIG_CMD,0xD30C},{SMART_CONFIG_DATA,0x2c},
{SMART_CONFIG_CMD,0xD30D},{SMART_CONFIG_DATA,0x43},
{SMART_CONFIG_CMD,0xD30E},{SMART_CONFIG_DATA,0x57},
{SMART_CONFIG_CMD,0xD30F},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD310},{SMART_CONFIG_DATA,0x68},
{SMART_CONFIG_CMD,0xD311},{SMART_CONFIG_DATA,0x78},
{SMART_CONFIG_CMD,0xD312},{SMART_CONFIG_DATA,0x87},
{SMART_CONFIG_CMD,0xD313},{SMART_CONFIG_DATA,0x94},
{SMART_CONFIG_CMD,0xD314},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD315},{SMART_CONFIG_DATA,0xa0},
{SMART_CONFIG_CMD,0xD316},{SMART_CONFIG_DATA,0xac},
{SMART_CONFIG_CMD,0xD317},{SMART_CONFIG_DATA,0xb6},
{SMART_CONFIG_CMD,0xD318},{SMART_CONFIG_DATA,0xc1},
{SMART_CONFIG_CMD,0xD319},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD31A},{SMART_CONFIG_DATA,0xcb},
{SMART_CONFIG_CMD,0xD31B},{SMART_CONFIG_DATA,0xcd},
{SMART_CONFIG_CMD,0xD31C},{SMART_CONFIG_DATA,0xd6},
{SMART_CONFIG_CMD,0xD31D},{SMART_CONFIG_DATA,0xdf},
{SMART_CONFIG_CMD,0xD31E},{SMART_CONFIG_DATA,0x95},
{SMART_CONFIG_CMD,0xD31F},{SMART_CONFIG_DATA,0xe8},
{SMART_CONFIG_CMD,0xD320},{SMART_CONFIG_DATA,0xf1},
{SMART_CONFIG_CMD,0xD321},{SMART_CONFIG_DATA,0xfa},
{SMART_CONFIG_CMD,0xD322},{SMART_CONFIG_DATA,0x02},
{SMART_CONFIG_CMD,0xD323},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD324},{SMART_CONFIG_DATA,0x0b},
{SMART_CONFIG_CMD,0xD325},{SMART_CONFIG_DATA,0x13},
{SMART_CONFIG_CMD,0xD326},{SMART_CONFIG_DATA,0x1d},
{SMART_CONFIG_CMD,0xD327},{SMART_CONFIG_DATA,0x26},
{SMART_CONFIG_CMD,0xD328},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD329},{SMART_CONFIG_DATA,0x30},
{SMART_CONFIG_CMD,0xD32A},{SMART_CONFIG_DATA,0x3c},
{SMART_CONFIG_CMD,0xD32B},{SMART_CONFIG_DATA,0x4A},
{SMART_CONFIG_CMD,0xD32C},{SMART_CONFIG_DATA,0x63},
{SMART_CONFIG_CMD,0xD32D},{SMART_CONFIG_DATA,0xea},
{SMART_CONFIG_CMD,0xD32E},{SMART_CONFIG_DATA,0x79},
{SMART_CONFIG_CMD,0xD32F},{SMART_CONFIG_DATA,0xa6},
{SMART_CONFIG_CMD,0xD330},{SMART_CONFIG_DATA,0xd0},
{SMART_CONFIG_CMD,0xD331},{SMART_CONFIG_DATA,0x20},
{SMART_CONFIG_CMD,0xD332},{SMART_CONFIG_DATA,0x0f},
{SMART_CONFIG_CMD,0xD333},{SMART_CONFIG_DATA,0x8e},
{SMART_CONFIG_CMD,0xD334},{SMART_CONFIG_DATA,0xff},
//GAMMA SETING RED
{SMART_CONFIG_CMD,0xD400},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD401},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD402},{SMART_CONFIG_DATA,0x1b},
{SMART_CONFIG_CMD,0xD403},{SMART_CONFIG_DATA,0x44},
{SMART_CONFIG_CMD,0xD404},{SMART_CONFIG_DATA,0x62},
{SMART_CONFIG_CMD,0xD405},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD406},{SMART_CONFIG_DATA,0x7b},
{SMART_CONFIG_CMD,0xD407},{SMART_CONFIG_DATA,0xa1},
{SMART_CONFIG_CMD,0xD408},{SMART_CONFIG_DATA,0xc0},
{SMART_CONFIG_CMD,0xD409},{SMART_CONFIG_DATA,0xee},
{SMART_CONFIG_CMD,0xD40A},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD40B},{SMART_CONFIG_DATA,0x10},
{SMART_CONFIG_CMD,0xD40C},{SMART_CONFIG_DATA,0x2c},
{SMART_CONFIG_CMD,0xD40D},{SMART_CONFIG_DATA,0x43},
{SMART_CONFIG_CMD,0xD40E},{SMART_CONFIG_DATA,0x57},
{SMART_CONFIG_CMD,0xD40F},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD410},{SMART_CONFIG_DATA,0x68},
{SMART_CONFIG_CMD,0xD411},{SMART_CONFIG_DATA,0x78},
{SMART_CONFIG_CMD,0xD412},{SMART_CONFIG_DATA,0x87},
{SMART_CONFIG_CMD,0xD413},{SMART_CONFIG_DATA,0x94},
{SMART_CONFIG_CMD,0xD414},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD415},{SMART_CONFIG_DATA,0xa0},
{SMART_CONFIG_CMD,0xD416},{SMART_CONFIG_DATA,0xac},
{SMART_CONFIG_CMD,0xD417},{SMART_CONFIG_DATA,0xb6},
{SMART_CONFIG_CMD,0xD418},{SMART_CONFIG_DATA,0xc1},
{SMART_CONFIG_CMD,0xD419},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD41A},{SMART_CONFIG_DATA,0xcb},
{SMART_CONFIG_CMD,0xD41B},{SMART_CONFIG_DATA,0xcd},
{SMART_CONFIG_CMD,0xD41C},{SMART_CONFIG_DATA,0xd6},
{SMART_CONFIG_CMD,0xD41D},{SMART_CONFIG_DATA,0xdf},
{SMART_CONFIG_CMD,0xD41E},{SMART_CONFIG_DATA,0x95},
{SMART_CONFIG_CMD,0xD41F},{SMART_CONFIG_DATA,0xe8},
{SMART_CONFIG_CMD,0xD420},{SMART_CONFIG_DATA,0xf1},
{SMART_CONFIG_CMD,0xD421},{SMART_CONFIG_DATA,0xfa},
{SMART_CONFIG_CMD,0xD422},{SMART_CONFIG_DATA,0x02},
{SMART_CONFIG_CMD,0xD423},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD424},{SMART_CONFIG_DATA,0x0b},
{SMART_CONFIG_CMD,0xD425},{SMART_CONFIG_DATA,0x13},
{SMART_CONFIG_CMD,0xD426},{SMART_CONFIG_DATA,0x1d},
{SMART_CONFIG_CMD,0xD427},{SMART_CONFIG_DATA,0x26},
{SMART_CONFIG_CMD,0xD428},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD429},{SMART_CONFIG_DATA,0x30},
{SMART_CONFIG_CMD,0xD42A},{SMART_CONFIG_DATA,0x3c},
{SMART_CONFIG_CMD,0xD42B},{SMART_CONFIG_DATA,0x4A},
{SMART_CONFIG_CMD,0xD42C},{SMART_CONFIG_DATA,0x63},
{SMART_CONFIG_CMD,0xD42D},{SMART_CONFIG_DATA,0xea},
{SMART_CONFIG_CMD,0xD42E},{SMART_CONFIG_DATA,0x79},
{SMART_CONFIG_CMD,0xD42F},{SMART_CONFIG_DATA,0xa6},
{SMART_CONFIG_CMD,0xD430},{SMART_CONFIG_DATA,0xd0},
{SMART_CONFIG_CMD,0xD431},{SMART_CONFIG_DATA,0x20},
{SMART_CONFIG_CMD,0xD432},{SMART_CONFIG_DATA,0x0f},
{SMART_CONFIG_CMD,0xD433},{SMART_CONFIG_DATA,0x8e},
{SMART_CONFIG_CMD,0xD434},{SMART_CONFIG_DATA,0xff},
//GAMMA SETING GREEN
{SMART_CONFIG_CMD,0xD500},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD501},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD502},{SMART_CONFIG_DATA,0x1b},
{SMART_CONFIG_CMD,0xD503},{SMART_CONFIG_DATA,0x44},
{SMART_CONFIG_CMD,0xD504},{SMART_CONFIG_DATA,0x62},
{SMART_CONFIG_CMD,0xD505},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD506},{SMART_CONFIG_DATA,0x7b},
{SMART_CONFIG_CMD,0xD507},{SMART_CONFIG_DATA,0xa1},
{SMART_CONFIG_CMD,0xD508},{SMART_CONFIG_DATA,0xc0},
{SMART_CONFIG_CMD,0xD509},{SMART_CONFIG_DATA,0xee},
{SMART_CONFIG_CMD,0xD50A},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD50B},{SMART_CONFIG_DATA,0x10},
{SMART_CONFIG_CMD,0xD50C},{SMART_CONFIG_DATA,0x2c},
{SMART_CONFIG_CMD,0xD50D},{SMART_CONFIG_DATA,0x43},
{SMART_CONFIG_CMD,0xD50E},{SMART_CONFIG_DATA,0x57},
{SMART_CONFIG_CMD,0xD50F},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD510},{SMART_CONFIG_DATA,0x68},
{SMART_CONFIG_CMD,0xD511},{SMART_CONFIG_DATA,0x78},
{SMART_CONFIG_CMD,0xD512},{SMART_CONFIG_DATA,0x87},
{SMART_CONFIG_CMD,0xD513},{SMART_CONFIG_DATA,0x94},
{SMART_CONFIG_CMD,0xD514},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD515},{SMART_CONFIG_DATA,0xa0},
{SMART_CONFIG_CMD,0xD516},{SMART_CONFIG_DATA,0xac},
{SMART_CONFIG_CMD,0xD517},{SMART_CONFIG_DATA,0xb6},
{SMART_CONFIG_CMD,0xD518},{SMART_CONFIG_DATA,0xc1},
{SMART_CONFIG_CMD,0xD519},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD51A},{SMART_CONFIG_DATA,0xcb},
{SMART_CONFIG_CMD,0xD51B},{SMART_CONFIG_DATA,0xcd},
{SMART_CONFIG_CMD,0xD51C},{SMART_CONFIG_DATA,0xd6},
{SMART_CONFIG_CMD,0xD51D},{SMART_CONFIG_DATA,0xdf},
{SMART_CONFIG_CMD,0xD51E},{SMART_CONFIG_DATA,0x95},
{SMART_CONFIG_CMD,0xD51F},{SMART_CONFIG_DATA,0xe8},
{SMART_CONFIG_CMD,0xD520},{SMART_CONFIG_DATA,0xf1},
{SMART_CONFIG_CMD,0xD521},{SMART_CONFIG_DATA,0xfa},
{SMART_CONFIG_CMD,0xD522},{SMART_CONFIG_DATA,0x02},
{SMART_CONFIG_CMD,0xD523},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD524},{SMART_CONFIG_DATA,0x0b},
{SMART_CONFIG_CMD,0xD525},{SMART_CONFIG_DATA,0x13},
{SMART_CONFIG_CMD,0xD526},{SMART_CONFIG_DATA,0x1d},
{SMART_CONFIG_CMD,0xD527},{SMART_CONFIG_DATA,0x26},
{SMART_CONFIG_CMD,0xD528},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD529},{SMART_CONFIG_DATA,0x30},
{SMART_CONFIG_CMD,0xD52A},{SMART_CONFIG_DATA,0x3c},
{SMART_CONFIG_CMD,0xD52B},{SMART_CONFIG_DATA,0x4a},
{SMART_CONFIG_CMD,0xD52C},{SMART_CONFIG_DATA,0x63},
{SMART_CONFIG_CMD,0xD52D},{SMART_CONFIG_DATA,0xea},
{SMART_CONFIG_CMD,0xD52E},{SMART_CONFIG_DATA,0x79},
{SMART_CONFIG_CMD,0xD52F},{SMART_CONFIG_DATA,0xa6},
{SMART_CONFIG_CMD,0xD530},{SMART_CONFIG_DATA,0xd0},
{SMART_CONFIG_CMD,0xD531},{SMART_CONFIG_DATA,0x20},
{SMART_CONFIG_CMD,0xD532},{SMART_CONFIG_DATA,0x0f},
{SMART_CONFIG_CMD,0xD533},{SMART_CONFIG_DATA,0x8e},
{SMART_CONFIG_CMD,0xD534},{SMART_CONFIG_DATA,0xff},
//GAMMA SETING BLUE
{SMART_CONFIG_CMD,0xD600},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD601},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD602},{SMART_CONFIG_DATA,0x1b},
{SMART_CONFIG_CMD,0xD603},{SMART_CONFIG_DATA,0x44},
{SMART_CONFIG_CMD,0xD604},{SMART_CONFIG_DATA,0x62},
{SMART_CONFIG_CMD,0xD605},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xD606},{SMART_CONFIG_DATA,0x7b},
{SMART_CONFIG_CMD,0xD607},{SMART_CONFIG_DATA,0xa1},
{SMART_CONFIG_CMD,0xD608},{SMART_CONFIG_DATA,0xc0},
{SMART_CONFIG_CMD,0xD609},{SMART_CONFIG_DATA,0xee},
{SMART_CONFIG_CMD,0xD60A},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD60B},{SMART_CONFIG_DATA,0x10},
{SMART_CONFIG_CMD,0xD60C},{SMART_CONFIG_DATA,0x2c},
{SMART_CONFIG_CMD,0xD60D},{SMART_CONFIG_DATA,0x43},
{SMART_CONFIG_CMD,0xD60E},{SMART_CONFIG_DATA,0x57},
{SMART_CONFIG_CMD,0xD60F},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD610},{SMART_CONFIG_DATA,0x68},
{SMART_CONFIG_CMD,0xD611},{SMART_CONFIG_DATA,0x78},
{SMART_CONFIG_CMD,0xD612},{SMART_CONFIG_DATA,0x87},
{SMART_CONFIG_CMD,0xD613},{SMART_CONFIG_DATA,0x94},
{SMART_CONFIG_CMD,0xD614},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD615},{SMART_CONFIG_DATA,0xa0},
{SMART_CONFIG_CMD,0xD616},{SMART_CONFIG_DATA,0xac},
{SMART_CONFIG_CMD,0xD617},{SMART_CONFIG_DATA,0xb6},
{SMART_CONFIG_CMD,0xD618},{SMART_CONFIG_DATA,0xc1},
{SMART_CONFIG_CMD,0xD619},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xD61A},{SMART_CONFIG_DATA,0xcb},
{SMART_CONFIG_CMD,0xD61B},{SMART_CONFIG_DATA,0xcd},
{SMART_CONFIG_CMD,0xD61C},{SMART_CONFIG_DATA,0xd6},
{SMART_CONFIG_CMD,0xD61D},{SMART_CONFIG_DATA,0xdf},
{SMART_CONFIG_CMD,0xD61E},{SMART_CONFIG_DATA,0x95},
{SMART_CONFIG_CMD,0xD61F},{SMART_CONFIG_DATA,0xe8},
{SMART_CONFIG_CMD,0xD620},{SMART_CONFIG_DATA,0xf1},
{SMART_CONFIG_CMD,0xD621},{SMART_CONFIG_DATA,0xfa},
{SMART_CONFIG_CMD,0xD622},{SMART_CONFIG_DATA,0x02},
{SMART_CONFIG_CMD,0xD623},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD624},{SMART_CONFIG_DATA,0x0b},
{SMART_CONFIG_CMD,0xD625},{SMART_CONFIG_DATA,0x13},
{SMART_CONFIG_CMD,0xD626},{SMART_CONFIG_DATA,0x1d},
{SMART_CONFIG_CMD,0xD627},{SMART_CONFIG_DATA,0x26},
{SMART_CONFIG_CMD,0xD628},{SMART_CONFIG_DATA,0xaa},
{SMART_CONFIG_CMD,0xD629},{SMART_CONFIG_DATA,0x30},
{SMART_CONFIG_CMD,0xD62A},{SMART_CONFIG_DATA,0x3c},
{SMART_CONFIG_CMD,0xD62B},{SMART_CONFIG_DATA,0x4A},
{SMART_CONFIG_CMD,0xD62C},{SMART_CONFIG_DATA,0x63},
{SMART_CONFIG_CMD,0xD62D},{SMART_CONFIG_DATA,0xea},
{SMART_CONFIG_CMD,0xD62E},{SMART_CONFIG_DATA,0x79},
{SMART_CONFIG_CMD,0xD62F},{SMART_CONFIG_DATA,0xa6},
{SMART_CONFIG_CMD,0xD630},{SMART_CONFIG_DATA,0xd0},
{SMART_CONFIG_CMD,0xD631},{SMART_CONFIG_DATA,0x20},
{SMART_CONFIG_CMD,0xD632},{SMART_CONFIG_DATA,0x0f},
{SMART_CONFIG_CMD,0xD633},{SMART_CONFIG_DATA,0x8e},
{SMART_CONFIG_CMD,0xD634},{SMART_CONFIG_DATA,0xff},
//AVDD VOLTAGE SETTING
{SMART_CONFIG_CMD,0xB000},{SMART_CONFIG_DATA,0x05},
{SMART_CONFIG_CMD,0xB001},{SMART_CONFIG_DATA,0x05},
{SMART_CONFIG_CMD,0xB002},{SMART_CONFIG_DATA,0x05},
//AVEE VOLTAGE SETTING
{SMART_CONFIG_CMD,0xB100},{SMART_CONFIG_DATA,0x05},
{SMART_CONFIG_CMD,0xB101},{SMART_CONFIG_DATA,0x05},
{SMART_CONFIG_CMD,0xB102},{SMART_CONFIG_DATA,0x05},
//AVDD Boosting
{SMART_CONFIG_CMD,0xB600},{SMART_CONFIG_DATA,0x34},
{SMART_CONFIG_CMD,0xB601},{SMART_CONFIG_DATA,0x34},
{SMART_CONFIG_CMD,0xB603},{SMART_CONFIG_DATA,0x34},
//AVEE Boosting
{SMART_CONFIG_CMD,0xB700},{SMART_CONFIG_DATA,0x24},
{SMART_CONFIG_CMD,0xB701},{SMART_CONFIG_DATA,0x24},
{SMART_CONFIG_CMD,0xB702},{SMART_CONFIG_DATA,0x24},
//VCL Boosting
{SMART_CONFIG_CMD,0xB800},{SMART_CONFIG_DATA,0x24},
{SMART_CONFIG_CMD,0xB801},{SMART_CONFIG_DATA,0x24},
{SMART_CONFIG_CMD,0xB802},{SMART_CONFIG_DATA,0x24},
//VGLX VOLTAGE SETTING
{SMART_CONFIG_CMD,0xBA00},{SMART_CONFIG_DATA,0x14},
{SMART_CONFIG_CMD,0xBA01},{SMART_CONFIG_DATA,0x14},
{SMART_CONFIG_CMD,0xBA02},{SMART_CONFIG_DATA,0x14},
//VCL Boosting
{SMART_CONFIG_CMD,0xB900},{SMART_CONFIG_DATA,0x24},
{SMART_CONFIG_CMD,0xB901},{SMART_CONFIG_DATA,0x24},
{SMART_CONFIG_CMD,0xB902},{SMART_CONFIG_DATA,0x24},
//Gamma Voltage
{SMART_CONFIG_CMD,0xBc00},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xBc01},{SMART_CONFIG_DATA,0xa0},//vgmp=5.0
{SMART_CONFIG_CMD,0xBc02},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xBd00},{SMART_CONFIG_DATA,0x00},
{SMART_CONFIG_CMD,0xBd01},{SMART_CONFIG_DATA,0xa0},//vgmn=5.0
{SMART_CONFIG_CMD,0xBd02},{SMART_CONFIG_DATA,0x00},
//VCOM Setting
{SMART_CONFIG_CMD,0xBe01},{SMART_CONFIG_DATA,0x3d},//3
//ENABLE PAGE 0
{SMART_CONFIG_CMD,0xF000},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xF001},{SMART_CONFIG_DATA,0xAA},
{SMART_CONFIG_CMD,0xF002},{SMART_CONFIG_DATA,0x52},
{SMART_CONFIG_CMD,0xF003},{SMART_CONFIG_DATA,0x08},
{SMART_CONFIG_CMD,0xF004},{SMART_CONFIG_DATA,0x00},
//Vivid Color Function Control
{SMART_CONFIG_CMD,0xB400},{SMART_CONFIG_DATA,0x10},
//Z-INVERSION
{SMART_CONFIG_CMD,0xBC00},{SMART_CONFIG_DATA,0x05},
{SMART_CONFIG_CMD,0xBC01},{SMART_CONFIG_DATA,0x05},
{SMART_CONFIG_CMD,0xBC02},{SMART_CONFIG_DATA,0x05},
//*************** add on 20111021**********************//
{SMART_CONFIG_CMD,0xB700},{SMART_CONFIG_DATA,0x22},//GATE EQ CONTROL
{SMART_CONFIG_CMD,0xB701},{SMART_CONFIG_DATA,0x22},//GATE EQ CONTROL
{SMART_CONFIG_CMD,0xC80B},{SMART_CONFIG_DATA,0x2A},//DISPLAY TIMING CONTROL
{SMART_CONFIG_CMD,0xC80C},{SMART_CONFIG_DATA,0x2A},//DISPLAY TIMING CONTROL
{SMART_CONFIG_CMD,0xC80F},{SMART_CONFIG_DATA,0x2A},//DISPLAY TIMING CONTROL
{SMART_CONFIG_CMD,0xC810},{SMART_CONFIG_DATA,0x2A},//DISPLAY TIMING CONTROL
//*************** add on 20111021**********************//
//PWM_ENH_OE =1
{SMART_CONFIG_CMD,0xd000},{SMART_CONFIG_DATA,0x01},
//DM_SEL =1
{SMART_CONFIG_CMD,0xb300},{SMART_CONFIG_DATA,0x10},
//VBPDA=07h
{SMART_CONFIG_CMD,0xBd02},{SMART_CONFIG_DATA,0x07},
//VBPDb=07h
{SMART_CONFIG_CMD,0xBe02},{SMART_CONFIG_DATA,0x07},
//VBPDc=07h
{SMART_CONFIG_CMD,0xBf02},{SMART_CONFIG_DATA,0x07},
//ENABLE PAGE 2
{SMART_CONFIG_CMD,0xF000},{SMART_CONFIG_DATA,0x55},
{SMART_CONFIG_CMD,0xF001},{SMART_CONFIG_DATA,0xAA},
{SMART_CONFIG_CMD,0xF002},{SMART_CONFIG_DATA,0x52},
{SMART_CONFIG_CMD,0xF003},{SMART_CONFIG_DATA,0x08},
{SMART_CONFIG_CMD,0xF004},{SMART_CONFIG_DATA,0x02},
//SDREG0 =0
{SMART_CONFIG_CMD,0xc301},{SMART_CONFIG_DATA,0xa9},
//DS=14
{SMART_CONFIG_CMD,0xfe01},{SMART_CONFIG_DATA,0x94},
//OSC =60h
{SMART_CONFIG_CMD,0xf600},{SMART_CONFIG_DATA,0x60},
//TE ON
{SMART_CONFIG_CMD,0x3500},{SMART_CONFIG_DATA,0x00},
//SLEEP OUT
{SMART_CONFIG_CMD,0x1100},
{SMART_CONFIG_UDELAY,1000},
//DISPLY ON
{SMART_CONFIG_CMD,0x2900},
{SMART_CONFIG_UDELAY,1000},
//SET BPP
#if CFG_LCD_BPP == USING_16_BPP
{SMART_CONFIG_CMD,0x3A00},{SMART_CONFIG_DATA,0x55},//16BIT PIXEL FORMAT
#elif CFG_LCD_BPP == USING_18_BPP
{SMART_CONFIG_CMD,0x3A00},{SMART_CONFIG_DATA,0x66},//18BIT PIXEL FORMAT
#elif CFG_LCD_BPP == USING_24_BPP
{SMART_CONFIG_CMD,0x3A00},{SMART_CONFIG_DATA,0x77},//24BIT PIXEL FORMAT
#else
#error "unknown bpp setting...\n";
#endif
// {SMART_CONFIG_CMD,0x3600},{SMART_CONFIG_DATA,0xe0},
{SMART_CONFIG_CMD,0x3600},{SMART_CONFIG_DATA,0xA0},
{SMART_CONFIG_UDELAY,1000},
//set block
{SMART_CONFIG_CMD,0x2a00},{SMART_CONFIG_DATA, 0 >> 8},
{SMART_CONFIG_CMD,0x2a01},{SMART_CONFIG_DATA, 0 & 0xFF},
{SMART_CONFIG_CMD,0x2a02},{SMART_CONFIG_DATA,800 >> 8},
{SMART_CONFIG_CMD,0x2a03},{SMART_CONFIG_DATA,800 & 0xFF},
{SMART_CONFIG_CMD,0x2b00},{SMART_CONFIG_DATA, 0 >> 8},
{SMART_CONFIG_CMD,0x2b01},{SMART_CONFIG_DATA, 0 & 0xFF},
{SMART_CONFIG_CMD,0x2b02},{SMART_CONFIG_DATA,480 >> 8},
{SMART_CONFIG_CMD,0x2b03},{SMART_CONFIG_DATA,480 & 0xFF},
{SMART_CONFIG_CMD,0x2C00}
};
struct slcd_configure _rm68120_config =
{
.width = 800,
.height = 480,
.fmt = RTGRAPHIC_PIXEL_FORMAT_RGB565,
.bpp = 16,
.bus_width = 8,
.reg_width = 16,
.rsply_cmd_high = 0,
.csply_active_high = 0,
/* write graphic ram command, in word, for example 8-bit bus, write_gram_cmd=C3C2C1C0. */
.newcfg_fmt_conv = 1,
.data_table = &_rm68120_data_table[0],
.data_table_num = sizeof(_rm68120_data_table)/sizeof(_rm68120_data_table[0]),
.cmd_table = &_rm68120_cmd_table[0],
.cmd_table_num = sizeof(_rm68120_cmd_table)/sizeof(_rm68120_cmd_table[0])
};
int rt_hw_rm68120_init(void)
{
/* reset lcd pane */
gpio_direction_output(LCD_RST_PORT, LCD_RST_PIN, 0); //reset
rt_thread_delay(rt_tick_from_millisecond(250));
gpio_set_value(LCD_RST_PORT, LCD_RST_PIN, 1);
rt_thread_delay(rt_tick_from_millisecond(100));
/* enable backlight */
gpio_direction_output(LCD_BL_PORT, LCD_BL_PIN,1);
/* init lcd & register lcd device */
rt_hw_slcd_init(&_rm68120_config);
return 0;
}
void rt_hw_rm68120_fill(rt_uint16_t color)
{
rt_uint32_t idx;
rt_uint16_t *ptr = (rt_uint16_t *)((FB_BASE + 4096));
int fb_size = (_rm68120_config.width * (_rm68120_config.bpp / 8)) * _rm68120_config.height;
rt_kprintf("fbbase = %08x,fb_size = %d\n",(rt_uint32_t)ptr,fb_size);
for (idx = 0; idx < (fb_size/2); ++idx)
{
*ptr = (rt_uint16_t)color;
ptr++;
}
rt_hw_dcache_flush_range(FB_BASE + 4096,fb_size);
}
#endif