44.Linux君正X1000-添加st7789v显示

时间:2021-08-19 08:45:42
struct smart_lcd_data_table ili9335_data_table[]={    //旧屏的初始化参数表
{SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0xec},
    {SMART_CONFIG_DATA,0x1e},
    {SMART_CONFIG_DATA,0x8f},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x01},
    {SMART_CONFIG_DATA,0x01},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x02},
    {SMART_CONFIG_DATA,0x02},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x03},
    {SMART_CONFIG_DATA,0x10},
    {SMART_CONFIG_DATA,0x30},

    {SMART_CONFIG_UDELAY,10000},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x08},
    {SMART_CONFIG_DATA,0x02},
    {SMART_CONFIG_DATA,0x02},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x09},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x0a},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x08}, //enable te
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x0d},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x0f},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x60},
    {SMART_CONFIG_DATA,0x27},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x61},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x6a},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_UDELAY,10000},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x10},
    {SMART_CONFIG_DATA,0x16},
    {SMART_CONFIG_DATA,0x90},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x11},
    {SMART_CONFIG_DATA,0x02},
    {SMART_CONFIG_DATA,0x27},
    
    {SMART_CONFIG_UDELAY,10000},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x12},
        {SMART_CONFIG_DATA,0x00},
        {SMART_CONFIG_DATA,0x0d},
    
    {SMART_CONFIG_UDELAY,10000},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x21},
    {SMART_CONFIG_DATA,0x16},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x29},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x18},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x2b},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x0a},
    
    {SMART_CONFIG_UDELAY,10000},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x20},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x21},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    //============Gamma============
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x30},
    {SMART_CONFIG_DATA,0x04},
    {SMART_CONFIG_DATA,0x03},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x31},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x07},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x32},
    {SMART_CONFIG_DATA,0x04},
    {SMART_CONFIG_DATA,0x04},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x35},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x02},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x36},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x0f},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x37},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x03},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x38},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x39},
    {SMART_CONFIG_DATA,0x03},
    {SMART_CONFIG_DATA,0x02},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x3c},
    {SMART_CONFIG_DATA,0x02},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x3d},
    {SMART_CONFIG_DATA,0x0f},
    {SMART_CONFIG_DATA,0x00},
      //=============================// set RAM address
  {SMART_CONFIG_CMD,0x00},
   {SMART_CONFIG_CMD,0x50},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x51},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0xef},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x52},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x53},
    {SMART_CONFIG_DATA,0x01},
    {SMART_CONFIG_DATA,0x3f},
    
    {SMART_CONFIG_UDELAY,10000},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x80},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x81},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x82},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x83},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x84},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x85},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x90},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x10},

    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x91},
    {SMART_CONFIG_DATA,0x06},
    {SMART_CONFIG_DATA,0x00},

    //display on
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x07},
    {SMART_CONFIG_DATA,0x01},
    {SMART_CONFIG_DATA,0x33},
    
    {SMART_CONFIG_CMD,0x00},
    {SMART_CONFIG_CMD,0x22},
    
};


unsigned long truly_cmd_buf[]= {
    0x22002200,
};
struct jzfb_config_info jzfb1_init_data= {
    .num_modes =1,
    .modes =&jzfb1_videomode,
    .lcd_type = LCD_TYPE_SLCD,
    .bpp    =24,                            //R8G8B8
    .pinmd=0,

    .smart_config.rsply_cmd_high       =0,
    .smart_config.csply_active_high    =0,
    
    .smart_config.newcfg_fmt_conv =0,
    .smart_config.clkply_active_rising =1,
    .smart_config.data_times =2,
    .smart_config.write_gram_cmd = truly_cmd_buf,
    .smart_config.length_cmd = ARRAY_SIZE(truly_cmd_buf),
    .smart_config.bus_width =8,                                    //总线8位的
    .smart_config.length_data_table=  ARRAY_SIZE(ili9335_data_table),
    .smart_config.data_table = ili9335_data_table,
    .dither_enable =1,
};

//新屏的初始化参数表
static struct smart_lcd_data_table New_ili9335_data_table[]= {
   {SMART_CONFIG_CMD,0x11},
       {SMART_CONFIG_UDELAY,120000},    //Sleep out
      {SMART_CONFIG_CMD,0x36},                //控制
    {SMART_CONFIG_DATA,0x00},
        
         {SMART_CONFIG_CMD,0x21},    //0x13显示不反转 ,21h 反显
         
         
    {SMART_CONFIG_CMD,0x3A},
    {SMART_CONFIG_DATA,0x05},

    {SMART_CONFIG_CMD,0x2A},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0xEF},

    {SMART_CONFIG_CMD,0x2B},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x01},
    {SMART_CONFIG_DATA,0x3F},

    {SMART_CONFIG_CMD,0xB2},        //前后肩
    {SMART_CONFIG_DATA,0x0C},
    {SMART_CONFIG_DATA,0x0C},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x33},
    {SMART_CONFIG_DATA,0x33},

    {SMART_CONFIG_CMD,0xB7},     //VGH VGL
    {SMART_CONFIG_DATA,0x35},

    {SMART_CONFIG_CMD,0xBB},     //VCOM 
    {SMART_CONFIG_DATA,0x1E},

    {SMART_CONFIG_CMD,0xC0},      //LCM
    {SMART_CONFIG_DATA,0x2C},

    {SMART_CONFIG_CMD,0xC2},
    {SMART_CONFIG_DATA,0x01},

    {SMART_CONFIG_CMD,0xC3},     //VRH( vcom+vcom offset+vdv) 
    {SMART_CONFIG_DATA,0x27},

    {SMART_CONFIG_CMD,0xC4},     //vdv
    {SMART_CONFIG_DATA,0x20},

    {SMART_CONFIG_CMD,0xC6},        //帧率
    {SMART_CONFIG_DATA,0x0F},

    {SMART_CONFIG_CMD,0xD0},        //功率控制模式   
    {SMART_CONFIG_DATA,0xA4},
    {SMART_CONFIG_DATA,0xA1},

    {SMART_CONFIG_CMD,0xE0},        //正GAMMA 
    {SMART_CONFIG_DATA,0xD0},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x05},
    {SMART_CONFIG_DATA,0x03},
    {SMART_CONFIG_DATA,0x02},
    {SMART_CONFIG_DATA,0x07},
    {SMART_CONFIG_DATA,0x3F},
    {SMART_CONFIG_DATA,0x55},
    {SMART_CONFIG_DATA,0x50},
    {SMART_CONFIG_DATA,0x09},
    {SMART_CONFIG_DATA,0x14},
    {SMART_CONFIG_DATA,0x15},
    {SMART_CONFIG_DATA,0x22},
    {SMART_CONFIG_DATA,0x25},

    {SMART_CONFIG_CMD,0xE1},    //负GAMMA
    {SMART_CONFIG_DATA,0xD0},
    {SMART_CONFIG_DATA,0x00},
    {SMART_CONFIG_DATA,0x05},
    {SMART_CONFIG_DATA,0x03},
    {SMART_CONFIG_DATA,0x02},
    {SMART_CONFIG_DATA,0x07},
    {SMART_CONFIG_DATA,0x3F},
    {SMART_CONFIG_DATA,0x55},
    {SMART_CONFIG_DATA,0x54},
    {SMART_CONFIG_DATA,0x0C},
    {SMART_CONFIG_DATA,0x18},
    {SMART_CONFIG_DATA,0x14},
    {SMART_CONFIG_DATA,0x22},
    {SMART_CONFIG_DATA,0x25},

    {SMART_CONFIG_CMD,0x11},    // sleep out
    {SMART_CONFIG_UDELAY,120000},

    {SMART_CONFIG_CMD,0x29},//Display On
    {SMART_CONFIG_UDELAY,20000},
};
unsigned long New_truly_cmd_buf[]= {
     0x2C2C2C2C,
};


void switch_lcd_New(void)              //切换为ST7789V
{
    jzfb1_init_data.smart_config.data_table = New_ili9335_data_table;
    jzfb1_init_data.smart_config.length_data_table =  ARRAY_SIZE(New_ili9335_data_table);
    jzfb1_init_data.smart_config.write_gram_cmd = New_truly_cmd_buf; 
}
//... ...

文章来源:https://www.cnblogs.com/lifexy/p/9371102.html