uint8_t u8x8_d_ssd1309_128x64_noname0(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { if ( u8x8_d_ssd1309_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) return 1; switch(msg) { case U8X8_MSG_DISPLAY_SET_FLIP_MODE: if ( arg_int == 0 ) { u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_flip0_seq); u8x8->x_offset = u8x8->display_info->default_x_offset; } else { u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_flip1_seq); u8x8->x_offset = u8x8->display_info->flipmode_x_offset; } break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_noname_init_seq); break; case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1309_128x64_noname0_display_info); break; default: return 0; } return 1; }
static uint8_t u8x8_d_bitmap(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { u8g2_uint_t x, y, c; uint8_t *ptr; switch(msg) { case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_bitmap_info); break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); /* update low level interfaces (not required here) */ break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: break; case U8X8_MSG_DISPLAY_SET_FLIP_MODE: break; case U8X8_MSG_DISPLAY_DRAW_TILE: x = ((u8x8_tile_t *)arg_ptr)->x_pos; y = ((u8x8_tile_t *)arg_ptr)->y_pos; c = ((u8x8_tile_t *)arg_ptr)->cnt; ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; do { u8x8_DrawBitmapTiles(u8x8, x, y, c, ptr); x += c; arg_int--; } while( arg_int > 0 ); break; default: return 0; } return 1; }
uint8_t u8x8_d_tga_lcd(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr) { u8g2_uint_t x, y, c; uint8_t *ptr; switch(msg) { case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8g2, &u8x8_tga_lcd_info); break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8g2); if ( tga_data == NULL ) tga_init(2*XOFFSET+DEFAULT_WIDTH, 2*YOFFSET+DEFAULT_HEIGHT); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: break; case U8X8_MSG_DISPLAY_SET_FLIP_MODE: break; case U8X8_MSG_DISPLAY_SET_CONTRAST: break; case U8X8_MSG_DISPLAY_DRAW_TILE: tga_fg_r = tga_lcd_fg_r; tga_fg_g = tga_lcd_fg_g; tga_fg_b = tga_lcd_fg_b; tga_bg_r = tga_lcd_bg_r; tga_bg_g = tga_lcd_bg_g; tga_bg_b = tga_lcd_bg_b; x = ((u8x8_tile_t *)arg_ptr)->x_pos; //printf("U8X8_MSG_DISPLAY_DRAW_TILE x=%d, ", x); x *= 8; x += u8g2->x_offset; x *= FACTOR; x += XOFFSET; y = ((u8x8_tile_t *)arg_ptr)->y_pos; //printf("y=%d, c=%d\n", y, ((u8x8_tile_t *)arg_ptr)->cnt); y *= 8; y *= FACTOR; y += YOFFSET; do { c = ((u8x8_tile_t *)arg_ptr)->cnt; ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; tga_set_multiple_8pixel(x, y, c*8, ptr, FACTOR); arg_int--; x += c*8*FACTOR; } while( arg_int > 0 ); break; default: return 0; } return 1; }
uint8_t u8x8_d_ssd1326_er_256x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) { u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1326_256x32_display_info); return 1; } return u8x8_d_ssd1326_256x32_generic(u8x8, msg, arg_int, arg_ptr); }
uint8_t u8x8_d_hx1230_96x68(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) { u8x8_d_helper_display_setup_memory(u8x8, &u8x8_hx1230_96x68_display_info); return 1; } return u8x8_d_hx1230_96x68_generic(u8x8, msg, arg_int, arg_ptr); }
uint8_t u8x8_d_a2printer_384x240(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { switch(msg) { case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_a2printer_384x240_display_info); break; default: return u8x8_d_a2printer_common(u8x8, msg, arg_int, arg_ptr); } return 1; }
uint8_t u8x8_d_ls013b7dh03_128x128(u8x8_t *u8x8, uint8_t msg, U8X8_UNUSED uint8_t arg_int, void *arg_ptr) { uint8_t y, c, i; uint8_t *ptr; switch(msg) { case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ls013b7dh03_128x128_display_info); break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); /* clear screen */ u8x8_cad_SendCmd(u8x8, SWAP8(LS013B7DH03_CMD_ALL_CLEAR) ); u8x8_cad_SendCmd(u8x8, LS013B7DH03_VAL_TRAILER); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: /* not available for the ls013b7dh03 */ break; case U8X8_MSG_DISPLAY_DRAW_TILE: /* each tile is 8 lines, with the data starting at the left edge */ y = ((((u8x8_tile_t *)arg_ptr)->y_pos) * 8) + 1; c = ((u8x8_tile_t *)arg_ptr)->cnt; ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* send data mode byte */ u8x8_cad_StartTransfer(u8x8); u8x8_cad_SendCmd(u8x8, SWAP8(LS013B7DH03_CMD_UPDATE) ); /* send 8 lines of 16 bytes (=128 pixels) */ for( i = 0; i < 8; i++ ) { u8x8_cad_SendCmd(u8x8, SWAP8(y + i) ); u8x8_cad_SendData(u8x8, c, ptr); u8x8_cad_SendCmd(u8x8, LS013B7DH03_VAL_TRAILER); ptr += c; } /* finish with a trailing byte */ u8x8_cad_SendCmd(u8x8, LS013B7DH03_VAL_TRAILER); u8x8_cad_EndTransfer(u8x8); break; default: return 0; } return 1; }
/* East Rising 0.66" OLED */ uint8_t u8x8_d_ssd1306_64x48_er(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) { u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_64x48_display_info); return 1; } else if ( msg == U8X8_MSG_DISPLAY_INIT ) { u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_64x48_er_init_seq); return 1; } return u8x8_d_ssd1306_64x48_generic(u8x8, msg, arg_int, arg_ptr); }
uint8_t u8x8_d_t6963_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { switch(msg) { case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_t6963_128x64_display_info); break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_128x64_init_seq); break; default: return u8x8_d_t6963_common(u8x8, msg, arg_int, arg_ptr); } return 1; }
uint8_t u8x8_d_sh1107_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { if ( u8x8_d_sh1107_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) return 1; switch(msg) { case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_sh1107_128x128_init_seq); break; case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1107_128x128_display_info); break; default: return 0; } return 1; }
uint8_t u8x8_d_uc1604_jlx19264(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { /* call common procedure first and handle messages there */ if ( u8x8_d_uc1604_common(u8x8, msg, arg_int, arg_ptr) == 0 ) { /* msg not handled, then try here */ switch(msg) { case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1604_192x64_display_info); break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_uc1604_jlx19264_init_seq); break; default: return 0; /* msg unknown */ } } return 1; }
uint8_t u8x8_d_sh1106_128x64_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { if ( u8x8_d_ssd1306_sh1106_generic(u8x8, msg, arg_int, arg_ptr) != 0 ) return 1; switch(msg) { case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); /* maybe use a better init sequence */ /* https://www.mikrocontroller.net/topic/431371 */ u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_init_seq); break; case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1106_128x64_noname_display_info); break; default: return 0; } return 1; }
uint8_t u8x8_d_pcd8544_84x48(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { uint8_t x, c; uint8_t *ptr; switch(msg) { case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_pcd8544_84x48_display_info); break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_pcd8544_84x48_init_seq); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: if ( arg_int == 0 ) u8x8_cad_SendSequence(u8x8, u8x8_d_pcd8544_84x48_powersave0_seq); else u8x8_cad_SendSequence(u8x8, u8x8_d_pcd8544_84x48_powersave1_seq); break; // case U8X8_MSG_DISPLAY_SET_FLIP_MODE: // break; NOT SUPPORTED #ifdef U8X8_WITH_SET_CONTRAST case U8X8_MSG_DISPLAY_SET_CONTRAST: u8x8_cad_StartTransfer(u8x8); u8x8_cad_SendCmd(u8x8, 0x021 ); /* command mode, extended function set */ u8x8_cad_SendCmd(u8x8, 0x080 | (arg_int >> 1) ); u8x8_cad_EndTransfer(u8x8); break; #endif case U8X8_MSG_DISPLAY_DRAW_TILE: u8x8_cad_StartTransfer(u8x8); x = ((u8x8_tile_t *)arg_ptr)->x_pos; x *= 8; x += u8x8->x_offset; u8x8_cad_SendCmd(u8x8, 0x020 ); /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ u8x8_cad_SendCmd(u8x8, 0x080 | (x) ); /* set X address */ u8x8_cad_SendCmd(u8x8, 0x040 | (((u8x8_tile_t *)arg_ptr)->y_pos) ); /* set Y address */ ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; c = ((u8x8_tile_t *)arg_ptr)->cnt; c *= 8; do { if ( c + x > 84u ) { if ( x >= 84u ) break; c = 84u; c -= x; } u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ x += c; arg_int--; } while( arg_int > 0 ); u8x8_cad_EndTransfer(u8x8); break; default: return 0; } return 1; }
/* left: 011, middle: 101, right: 110, no chip select: 111 */ uint8_t u8x8_d_ks0108_erm19264(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { struct u8x8_ks0108_vars v; switch(msg) { case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ks0108_128x64_display_info); break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 3, NULL); u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_init_seq); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 5, NULL); u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_init_seq); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 6, NULL); u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_init_seq); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: if ( arg_int == 0 ) { u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 3, NULL); u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave0_seq); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 5, NULL); u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave0_seq); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 6, NULL); u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave0_seq); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); } else { u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 3, NULL); u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave1_seq); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 5, NULL); u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave1_seq); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 6, NULL); u8x8_cad_SendSequence(u8x8, u8x8_d_ks0108_powersave1_seq); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); } break; // The KS0108 can not mirror the cols and rows, use U8g2 for rotation // case U8X8_MSG_DISPLAY_SET_FLIP_MODE: // break; // The KS0108 has no internal contrast command // case U8X8_MSG_DISPLAY_SET_CONTRAST: // break; case U8X8_MSG_DISPLAY_DRAW_TILE: v.ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; v.x = ((u8x8_tile_t *)arg_ptr)->x_pos; v.c = ((u8x8_tile_t *)arg_ptr)->cnt; v.arg_int = arg_int; if ( v.x < 8 ) { u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 3, NULL); u8x8_ks0108_out(u8x8, &v, arg_ptr); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); } if ( v.x < 16 ) { u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 5, NULL); u8x8_ks0108_out(u8x8, &v, arg_ptr); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); } if ( v.x < 24 ) { u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 6, NULL); u8x8_ks0108_out(u8x8, &v, arg_ptr); u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 7, NULL); } break; default: return 0; } return 1; }
uint8_t u8x8_d_uc1701_mini12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { uint8_t x, c; uint8_t *ptr; switch(msg) { case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1701_display_info); break; case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_init_seq); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: if ( arg_int == 0 ) u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_powersave0_seq); else u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_powersave1_seq); break; case U8X8_MSG_DISPLAY_SET_FLIP_MODE: if ( arg_int == 0 ) { u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_flip0_seq); u8x8->x_offset = u8x8->display_info->default_x_offset; } else { u8x8_cad_SendSequence(u8x8, u8x8_d_uc1701_mini12864_flip1_seq); u8x8->x_offset = u8x8->display_info->flipmode_x_offset; } break; #ifdef U8X8_WITH_SET_CONTRAST case U8X8_MSG_DISPLAY_SET_CONTRAST: u8x8_cad_StartTransfer(u8x8); u8x8_cad_SendCmd(u8x8, 0x081 ); u8x8_cad_SendArg(u8x8, arg_int >> 2 ); /* uc1701 has range from 0 to 63 */ u8x8_cad_EndTransfer(u8x8); break; #endif case U8X8_MSG_DISPLAY_DRAW_TILE: u8x8_cad_StartTransfer(u8x8); x = ((u8x8_tile_t *)arg_ptr)->x_pos; x *= 8; x += u8x8->x_offset; u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) ); u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15))); u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos)); c = ((u8x8_tile_t *)arg_ptr)->cnt; c *= 8; ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* The following if condition checks the hardware limits of the uc1701 controller: It is not allowed to write beyond the display limits. This is in fact an issue within flip mode. bug: this check should be inside the while loop, see u8x8_d_pcd8544_84x48.c */ if ( c + x > 132u ) { c = 132u; c -= x; } do { u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */ arg_int--; } while( arg_int > 0 ); u8x8_cad_EndTransfer(u8x8); break; default: return 0; } return 1; }