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_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; }
static uint8_t u8x8_d_hx1230_96x68_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { uint8_t x, c; uint8_t *ptr; switch(msg) { /* handled by the calling function case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_hx1230_96x68_display_info); break; */ case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_init_seq); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: if ( arg_int == 0 ) u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_powersave0_seq); else u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_powersave1_seq); break; case U8X8_MSG_DISPLAY_SET_FLIP_MODE: if ( arg_int == 0 ) { u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_flip0_seq); u8x8->x_offset = u8x8->display_info->default_x_offset; } else { u8x8_cad_SendSequence(u8x8, u8x8_d_hx1230_96x68_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, (arg_int>>3)|0x80 ); /* 0..31 for contrast */ 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, x&15); u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4)); u8x8_cad_SendCmd(u8x8, 0x0b0 | ((u8x8_tile_t *)arg_ptr)->y_pos); do { c = ((u8x8_tile_t *)arg_ptr)->cnt; ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; u8x8_cad_SendData(u8x8, c*8, 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; }
uint8_t u8x8_d_a2printer_common(u8x8_t *u8x8, uint8_t msg, U8X8_UNUSED uint8_t arg_int, void *arg_ptr) { uint8_t c, i, j; uint8_t *ptr; uint16_t delay_in_milliseconds; switch(msg) { /* U8X8_MSG_DISPLAY_SETUP_MEMORY is handled by the calling function */ /* case U8X8_MSG_DISPLAY_SETUP_MEMORY: break; */ case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); // no setup required // u8x8_cad_SendSequence(u8x8, u8x8_d_a2printer_init_seq); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: // no powersave break; case U8X8_MSG_DISPLAY_DRAW_TILE: u8x8_cad_StartTransfer(u8x8); u8x8_cad_SendCmd(u8x8, 27); /* ESC */ u8x8_cad_SendCmd(u8x8, 55 ); /* parameter command */ /* increasing the "max printing dots" requires a good power supply, but LINE_EXTRA_8PIXEL_DELAY_MS could be reduced then */ u8x8_cad_SendCmd(u8x8, 0); /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1) ... lower values improve, probably my current supply is not sufficient */ u8x8_cad_SendCmd(u8x8, 200); /* 3-255 Heating time,Unit(10us),Default:80(800us) */ u8x8_cad_SendCmd(u8x8, 2); /* 0-255 Heating interval,Unit(10us),Default:2(20us) ... does not have much influence */ //c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */ c = u8x8->display_info->tile_width; ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* data ptr to the tiles */ u8x8_cad_SendCmd(u8x8, 18); /* DC2 */ u8x8_cad_SendCmd(u8x8, 42 ); /* * */ u8x8_cad_SendCmd(u8x8, 8 ); /* height */ u8x8_cad_SendCmd(u8x8, c ); /* c, u8x8->display_info->tile_width */ for( j = 0; j < 8 / NO_OF_LINES_TO_SEND_WITHOUT_DELAY; j ++ ) { delay_in_milliseconds = 0; for( i = 0; i < NO_OF_LINES_TO_SEND_WITHOUT_DELAY; i++ ) { u8x8_cad_SendData(u8x8, c, ptr); /* c, note: SendData can not handle more than 255 bytes, send one line of data */ delay_in_milliseconds += get_delay_in_milliseconds(c, ptr); ptr += c; } while( delay_in_milliseconds > 200 ) { u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_MILLI, 200, NULL); delay_in_milliseconds -= 200; } u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_MILLI, delay_in_milliseconds, NULL); } /* set parameters back to their default values */ u8x8_cad_SendCmd(u8x8, 27); /* ESC */ u8x8_cad_SendCmd(u8x8, 55 ); /* parameter command */ u8x8_cad_SendCmd(u8x8, 7); /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1)*/ u8x8_cad_SendCmd(u8x8, 80); /* 3-255 Heating time,Unit(10us),Default:80(800us) */ u8x8_cad_SendCmd(u8x8, 2); /* 0-255 Heating interval,Unit(10us),Default:2(20us)*/ u8x8_cad_EndTransfer(u8x8); 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; }
/* 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; }
static uint8_t u8x8_d_ssd1326_256x32_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { uint8_t x, y, c; uint8_t *ptr; switch(msg) { /* handled by the calling function case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1326_256x32_nhd_display_info); break; */ case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_er_256x32_init_seq); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: if ( arg_int == 0 ) u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_256x32_nhd_powersave0_seq); else u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_256x32_nhd_powersave1_seq); break; case U8X8_MSG_DISPLAY_SET_FLIP_MODE: if ( arg_int == 0 ) { u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_256x32_nhd_flip0_seq); u8x8->x_offset = u8x8->display_info->default_x_offset; } else { u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1326_256x32_nhd_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 ); /* ssd1326 has range from 0 to 255 */ 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 *= 4; y = (((u8x8_tile_t *)arg_ptr)->y_pos); y *= 8; y += u8x8->x_offset; /* x_offset is used as y offset for the ssd1326 */ do { c = ((u8x8_tile_t *)arg_ptr)->cnt; ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; do { /* tile is empty, use the graphics acceleration command */ /* are this really available on the ssd1326??? */ u8x8_cad_SendCmd(u8x8, 0x024 ); // draw rectangle u8x8_cad_SendArg(u8x8, x ); u8x8_cad_SendArg(u8x8, y ); u8x8_cad_SendArg(u8x8, x+3 ); u8x8_cad_SendArg(u8x8, y+7 ); u8x8_cad_SendArg(u8x8, 0 ); // clear ptr += 8; x += 4; c--; } while( c > 0 ); //x += 4; arg_int--; } while( arg_int > 0 ); u8x8_cad_EndTransfer(u8x8); break; default: return 0; } return 1; }
static uint8_t u8x8_d_ssd1606_172x72_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { switch(msg) { /* handled by the calling function case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1606_172x72_display_info); break; */ case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_gde021a1_init_seq); /* special code for the SSD1606... */ /* ensure that the initial buffer is clear and all eInk is set to white */ /* this is done here, because the LUT will be of that kind, that it uses the previous color */ /* make everything black */ u8x8_FillDisplay(u8x8); /* write content to the display */ u8x8_RefreshDisplay(u8x8); /* now make everything clear */ u8x8_FillDisplay(u8x8); /* write content to the display */ u8x8_RefreshDisplay(u8x8); /* now make everything clear */ u8x8_ClearDisplay(u8x8); /* write content to the display */ u8x8_RefreshDisplay(u8x8); u8x8_ClearDisplay(u8x8); /* write content to the display */ u8x8_RefreshDisplay(u8x8); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: /* if ( arg_int == 0 ) u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_powersave0_seq); else u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_powersave1_seq); */ break; case U8X8_MSG_DISPLAY_SET_FLIP_MODE: /* if ( arg_int == 0 ) { u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_flip0_seq); u8x8->x_offset = u8x8->display_info->default_x_offset; } else { u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_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_EndTransfer(u8x8); */ break; #endif case U8X8_MSG_DISPLAY_DRAW_TILE: u8x8_d_ssd1606_draw_tile(u8x8, arg_int, arg_ptr); break; case U8X8_MSG_DISPLAY_REFRESH: u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_to_display_seq); 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; }
static uint8_t u8x8_d_ssd1306_128x32_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) { uint8_t x, c; uint8_t *ptr; switch(msg) { /* handled by the calling function case U8X8_MSG_DISPLAY_SETUP_MEMORY: u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_128x32_univision_display_info); break; */ case U8X8_MSG_DISPLAY_INIT: u8x8_d_helper_display_init(u8x8); u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_init_seq); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: if ( arg_int == 0 ) u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_powersave0_seq); else u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_powersave1_seq); break; case U8X8_MSG_DISPLAY_SET_FLIP_MODE: if ( arg_int == 0 ) { u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_flip0_seq); u8x8->x_offset = u8x8->display_info->default_x_offset; } else { u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x32_univision_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 ); /* ssd1306 has range from 0 to 255 */ 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)); do { c = ((u8x8_tile_t *)arg_ptr)->cnt; ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */ /* do { u8x8_cad_SendData(u8x8, 8, ptr); ptr += 8; c--; } while( c > 0 ); */ arg_int--; } while( arg_int > 0 ); u8x8_cad_EndTransfer(u8x8); break; default: return 0; } return 1; }
uint8_t u8x8_d_ssd1306_128x64_noname(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_INIT: u8x8_d_helper_display_init(u8x8, &u8x8_ssd1306_128x64_noname_display_info); u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_init_seq); break; case U8X8_MSG_DISPLAY_SET_POWER_SAVE: if ( arg_int == 0 ) u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_powersave0_seq); else u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_powersave1_seq); break; #ifdef U8X8_WITH_SET_FLIP_MODE case U8X8_MSG_DISPLAY_SET_FLIP_MODE: if ( arg_int == 0 ) u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_flip0_seq); else u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_128x64_noname_flip1_seq); break; #endif #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 ); /* ssd1306 has range from 0 to 255 */ 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)); do { c = ((u8x8_tile_t *)arg_ptr)->cnt; ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; do { u8x8_cad_SendData(u8x8, 8, ptr); ptr += 8; c--; } while( c > 0 ); arg_int--; } while( arg_int > 0 ); u8x8_cad_EndTransfer(u8x8); break; default: return 0; } return 1; }