ucg_int_t ucg_dev_ili9341_18x240x320(ucg_t *ucg, ucg_int_t msg, void *data) { switch(msg) { case UCG_MSG_DEV_POWER_UP: /* 1. Call to the controller procedures to setup the com interface */ if ( ucg_dev_ic_ili9341_18(ucg, msg, data) == 0 ) return 0; /* 2. Send specific init sequence for this display module */ ucg_com_SendCmdSeq(ucg, ucg_tft_240x320_ili9341_init_seq); return 1; case UCG_MSG_DEV_POWER_DOWN: /* let do power down by the conroller procedures */ return ucg_dev_ic_ili9341_18(ucg, msg, data); case UCG_MSG_GET_DIMENSION: ((ucg_wh_t *)data)->w = 240; ((ucg_wh_t *)data)->h = 320; return 1; } /* all other messages are handled by the controller procedures */ return ucg_dev_ic_ili9341_18(ucg, msg, data); }
static ucg_int_t ucg_handle_ld50t6160_l90tc(ucg_t *ucg) { if ( ucg_clip_l90tc(ucg) != 0 ) { uint8_t buf[3]; ucg_int_t dx, dy; ucg_int_t i; const uint8_t *seq; unsigned char pixmap; uint8_t bitcnt; ucg_com_SetCSLineStatus(ucg, 0); /* enable chip */ switch(ucg->arg.dir) { case 0: dx = 1; dy = 0; seq = ucg_ld50t6160_set_pos_dir0_seq; break; case 1: dx = 0; dy = 1; seq = ucg_ld50t6160_set_pos_dir1_seq; break; case 2: dx = -1; dy = 0; seq = ucg_ld50t6160_set_pos_dir2_seq; break; case 3: default: dx = 0; dy = -1; seq = ucg_ld50t6160_set_pos_dir3_seq; break; } pixmap = ucg_pgm_read(ucg->arg.bitmap); bitcnt = ucg->arg.pixel_skip; pixmap <<= bitcnt; buf[0] = ucg->arg.pixel.rgb.color[0]>>2; buf[1] = ucg->arg.pixel.rgb.color[1]>>2; buf[2] = ucg->arg.pixel.rgb.color[2]>>2; for( i = 0; i < ucg->arg.len; i++ ) { if ( (pixmap & 128) != 0 ) { ucg_com_SendCmdSeq(ucg, seq); ucg_com_SendRepeat3Bytes(ucg, 1, buf); } pixmap<<=1; ucg->arg.pixel.pos.x+=dx; ucg->arg.pixel.pos.y+=dy; bitcnt++; if ( bitcnt >= 8 ) { ucg->arg.bitmap++; pixmap = ucg_pgm_read(ucg->arg.bitmap); bitcnt = 0; } } ucg_com_SetCSLineStatus(ucg, 1); /* disable chip */ return 1; }
ucg_int_t ICACHE_FLASH_ATTR ucg_handle_ili9163_l90fx(ucg_t *ucg) { uint8_t c[3]; ucg_int_t tmp; if ( ucg_clip_l90fx(ucg) != 0 ) { switch(ucg->arg.dir) { case 0: ucg->arg.pixel.pos.y += 32; ucg_com_SendCmdSeq(ucg, ucg_ili9163_set_pos_dir0_seq); ucg->arg.pixel.pos.y -= 32; break; case 1: ucg->arg.pixel.pos.y += 32; ucg_com_SendCmdSeq(ucg, ucg_ili9163_set_pos_dir1_seq); ucg->arg.pixel.pos.y -= 32; break; case 2: tmp = ucg->arg.pixel.pos.x; ucg->arg.pixel.pos.x = 127-tmp; ucg->arg.pixel.pos.y += 32; ucg_com_SendCmdSeq(ucg, ucg_ili9163_set_pos_dir2_seq); ucg->arg.pixel.pos.y -= 32; ucg->arg.pixel.pos.x = tmp; break; case 3: default: tmp = ucg->arg.pixel.pos.y; ucg->arg.pixel.pos.y = 127-tmp; //ucg->arg.pixel.pos.y += 32; ucg_com_SendCmdSeq(ucg, ucg_ili9163_set_pos_dir3_seq); ucg->arg.pixel.pos.y = tmp; break; } c[0] = ucg->arg.pixel.rgb.color[0]; c[1] = ucg->arg.pixel.rgb.color[1]; c[2] = ucg->arg.pixel.rgb.color[2]; ucg_com_SendRepeat3Bytes(ucg, ucg->arg.len, c); ucg_com_SetCSLineStatus(ucg, 1); /* disable chip */ return 1; } return 0; }
static ucg_int_t ucg_handle_ld50t6160_l90fx(ucg_t *ucg) { uint8_t c[3]; //ucg_int_t tmp; if ( ucg_clip_l90fx(ucg) != 0 ) { switch(ucg->arg.dir) { case 0: ucg_com_SendCmdSeq(ucg, ucg_ld50t6160_set_pos_dir0_seq); break; case 1: ucg_com_SendCmdSeq(ucg, ucg_ld50t6160_set_pos_dir1_seq); break; case 2: //tmp = ucg->arg.pixel.pos.x; //ucg->arg.pixel.pos.x = 127-tmp; ucg_com_SendCmdSeq(ucg, ucg_ld50t6160_set_pos_dir2_seq); //ucg->arg.pixel.pos.x = tmp; break; case 3: default: //tmp = ucg->arg.pixel.pos.y; //ucg->arg.pixel.pos.y = 159-tmp; ucg_com_SendCmdSeq(ucg, ucg_ld50t6160_set_pos_dir3_seq); //ucg->arg.pixel.pos.y = tmp; break; } c[0] = ucg->arg.pixel.rgb.color[0]>>2; c[1] = ucg->arg.pixel.rgb.color[1]>>2; c[2] = ucg->arg.pixel.rgb.color[2]>>2; ucg_com_SendRepeat3Bytes(ucg, ucg->arg.len, c); ucg_com_SetCSLineStatus(ucg, 1); /* disable chip */ return 1; } return 0; }
ucg_int_t ICACHE_FLASH_ATTR ucg_dev_pcf8833_16x132x132(ucg_t *ucg, ucg_int_t msg, void *data) { switch(msg) { case UCG_MSG_DEV_POWER_UP: /* 1. Call to the controller procedures to setup the com interface */ if ( ucg_dev_ic_pcf8833_16(ucg, msg, data) == 0 ) return 0; /* 2. Send specific init sequence for this display module */ ucg_com_SendCmdSeq(ucg, ucg_tft_132x132_pcf8833_init_seq); return 1; case UCG_MSG_DEV_POWER_DOWN: /* let do power down by the conroller procedures */ return ucg_dev_ic_pcf8833_16(ucg, msg, data); } /* all other messages are handled by the controller procedures */ return ucg_dev_ic_pcf8833_16(ucg, msg, data); }
/* with CmdDataSequence */ ucg_int_t ICACHE_FLASH_ATTR ucg_handle_st7735_l90tc(ucg_t *ucg) { if ( ucg_clip_l90tc(ucg) != 0 ) { uint8_t buf[16]; ucg_int_t dx, dy; ucg_int_t i; unsigned char pixmap; uint8_t bitcnt; ucg_com_SetCSLineStatus(ucg, 0); /* enable chip */ ucg_com_SendCmdSeq(ucg, ucg_st7735_set_pos_seq); buf[0] = 0x001; // change to 0 (cmd mode) buf[1] = 0x02a; // set x buf[2] = 0x002; // change to 1 (arg mode) buf[3] = 0x000; // upper part x buf[4] = 0x000; // no change buf[5] = 0x000; // will be overwritten by x value buf[6] = 0x001; // change to 0 (cmd mode) buf[7] = 0x02c; // write data buf[8] = 0x002; // change to 1 (data mode) buf[9] = 0x000; // red value buf[10] = 0x000; // no change buf[11] = 0x000; // green value buf[12] = 0x000; // no change buf[13] = 0x000; // blue value switch(ucg->arg.dir) { case 0: dx = 1; dy = 0; buf[1] = 0x02a; // set x break; case 1: dx = 0; dy = 1; buf[1] = 0x02b; // set y break; case 2: dx = -1; dy = 0; buf[1] = 0x02a; // set x break; case 3: default: dx = 0; dy = -1; buf[1] = 0x02b; // set y break; } pixmap = ucg_pgm_read(ucg->arg.bitmap); bitcnt = ucg->arg.pixel_skip; pixmap <<= bitcnt; buf[9] = ucg->arg.pixel.rgb.color[0]; buf[11] = ucg->arg.pixel.rgb.color[1]; buf[13] = ucg->arg.pixel.rgb.color[2]; //ucg_com_SetCSLineStatus(ucg, 0); /* enable chip */ for( i = 0; i < ucg->arg.len; i++ ) { if ( (pixmap & 128) != 0 ) { if ( (ucg->arg.dir&1) == 0 ) { buf[5] = ucg->arg.pixel.pos.x; } else { buf[3] = ucg->arg.pixel.pos.y>>8; buf[5] = ucg->arg.pixel.pos.y&255; } ucg_com_SendCmdDataSequence(ucg, 7, buf, 0); } pixmap<<=1; ucg->arg.pixel.pos.x+=dx; ucg->arg.pixel.pos.y+=dy; bitcnt++; if ( bitcnt >= 8 ) { ucg->arg.bitmap++; pixmap = ucg_pgm_read(ucg->arg.bitmap); bitcnt = 0; } } ucg_com_SetCSLineStatus(ucg, 1); /* disable chip */ return 1; }
ucg_int_t ucg_dev_seps225_16x128x128_univision(ucg_t *ucg, ucg_int_t msg, void *data) { switch(msg) { case UCG_MSG_DEV_POWER_UP: /* 1. Call to the controller procedures to setup the com interface */ if ( ucg_dev_ic_seps225_16(ucg, msg, data) == 0 ) return 0; /* 2. Send specific init sequence for this display module */ ucg_com_SendCmdSeq(ucg, ucg_univision_seps225_init_seq); /* demonstration of the OLED error */ /* { uint8_t r,g,b, i; uint8_t c[3]; ucg_com_SendCmdSeq(ucg, ucg_seps255_pos_dir0_seq); r = 0; g = 0; b = 80; c[0] = (r&0x0f8) | (((g) >>5)); c[1] = ((((g))<<3)&0x0e0) | (((b) >>3)); ucg_com_SendRepeat2Bytes(ucg, 128, c); r = 0; g = 0; b = 0; c[0] = (r&0x0f8) | (((g) >>5)); c[1] = ((((g))<<3)&0x0e0) | (((b) >>3)); for( i = 0; i < 126; i++ ) { ucg_com_SendRepeat2Bytes(ucg, 128, c); } r = 0; g = 0; b = 255; c[0] = (r&0x0f8) | (((g) >>5)); c[1] = ((((g))<<3)&0x0e0) | (((b) >>3)); ucg_com_SendRepeat2Bytes(ucg, 40, c); for(;;) ; } */ return 1; case UCG_MSG_DEV_POWER_DOWN: /* let do power down by the controller procedures */ return ucg_dev_ic_seps225_16(ucg, msg, data); case UCG_MSG_GET_DIMENSION: ((ucg_wh_t *)data)->w = 128; ((ucg_wh_t *)data)->h = 128; return 1; } /* all other messages are handled by the controller procedures */ return ucg_dev_ic_seps225_16(ucg, msg, data); }