Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

u8x8_draw_hvtile + added display drivers #1327

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
366 changes: 364 additions & 2 deletions cppsrc/U8g2lib.h

Large diffs are not rendered by default.

1,104 changes: 1,102 additions & 2 deletions cppsrc/U8x8lib.h

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions csrc/u8g2.h
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,12 @@ void u8g2_Setup_sh1122_256x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_ms
void u8g2_Setup_sh1122_i2c_256x64_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_sh1122_i2c_256x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_sh1122_i2c_256x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_sh1122_256x64_midas_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_sh1122_256x64_midas_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_sh1122_256x64_midas_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_sh1122_i2c_256x64_midas_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_sh1122_i2c_256x64_midas_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_sh1122_i2c_256x64_midas_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1306_128x32_univision_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1306_128x32_winstar_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1306_128x32_univision_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
Expand Down Expand Up @@ -835,6 +841,12 @@ void u8g2_Setup_ssd1327_i2c_visionox_128x96_f(u8g2_t *u8g2, const u8g2_cb_t *rot
void u8g2_Setup_ssd1329_128x96_noname_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1329_128x96_noname_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1329_128x96_noname_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1362_256x64_raystar_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1362_256x64_raystar_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1362_256x64_raystar_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1362_i2c_256x64_raystar_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1362_i2c_256x64_raystar_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ssd1362_i2c_256x64_raystar_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ld7032_60x32_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ld7032_60x32_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
void u8g2_Setup_ld7032_60x32_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
Expand Down
23 changes: 15 additions & 8 deletions csrc/u8g2_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static void u8g2_send_tile_row(u8g2_t *u8g2, uint8_t src_tile_row, uint8_t dest_
offset *= w;
offset *= 8;
ptr += offset;
u8x8_DrawTile(u8g2_GetU8x8(u8g2), 0, dest_tile_row, w, ptr);
u8x8_DrawTile(u8g2_GetU8x8(u8g2), 0/*tx*/, dest_tile_row/*ty*/, w/*tile_cnt*/, 1/*copies*/, w/*tile_buffer_width*/, ptr);
}

/*
Expand Down Expand Up @@ -153,25 +153,32 @@ uint8_t u8g2_NextPage(u8g2_t *u8g2)
void u8g2_UpdateDisplayArea(u8g2_t *u8g2, uint8_t tx, uint8_t ty, uint8_t tw, uint8_t th)
{
uint16_t page_size;
uint8_t tile_buffer_width;
uint8_t *ptr;

/* check, whether we are in full buffer mode */
if ( u8g2->tile_buf_height != u8g2_GetU8x8(u8g2)->display_info->tile_height )
return; /* not in full buffer mode, do nothing */

page_size = u8g2->pixel_buf_width; /* 8*u8g2->u8g2_GetU8x8(u8g2)->display_info->tile_width */

tile_buffer_width = u8g2_GetU8x8(u8g2)->display_info->tile_width;
page_size = u8g2->pixel_buf_width; /* 8*u8g2_GetU8x8(u8g2)->display_info->tile_width */

ptr = u8g2_GetBufferPtr(u8g2);
ptr += tx*8;

if(u8g2->ll_hvline == u8g2_ll_hvline_vertical_top_lsb){
ptr += tx*8; /* 8 bytes across per tile, stacked vertically */
}else{
ptr += tx; /* 1 byte across per tile, stacked horizontally */
}
ptr += page_size*ty;

while( th > 0 )
{
u8x8_DrawTile( u8g2_GetU8x8(u8g2), tx, ty, tw, ptr );
u8x8_DrawTile( u8g2_GetU8x8(u8g2), tx, ty, tw/*tile_cnt*/, 1/*copies*/, tile_buffer_width, ptr );
ptr += page_size;
ty++;
th--;
}
}
}

/* same as sendBuffer, but does not send the ePaper refresh message */
Expand Down
104 changes: 104 additions & 0 deletions csrc/u8g2_d_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,14 @@ void u8g2_Setup_sh1122_256x64_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_ms
buf = u8g2_m_32_8_1(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
void u8g2_Setup_sh1122_256x64_midas_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_sh1122_256x64_midas, u8x8_cad_001, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_1(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* sh1122 2 */
void u8g2_Setup_sh1122_256x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
Expand All @@ -1050,6 +1058,14 @@ void u8g2_Setup_sh1122_256x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_ms
buf = u8g2_m_32_8_2(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
void u8g2_Setup_sh1122_256x64_midas_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_sh1122_256x64_midas, u8x8_cad_001, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_2(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* sh1122 f */
void u8g2_Setup_sh1122_256x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
Expand All @@ -1059,6 +1075,14 @@ void u8g2_Setup_sh1122_256x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_ms
buf = u8g2_m_32_8_f(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
void u8g2_Setup_sh1122_256x64_midas_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_sh1122_256x64_midas, u8x8_cad_001, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_f(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* sh1122 */
/* sh1122 1 */
void u8g2_Setup_sh1122_i2c_256x64_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
Expand All @@ -1069,6 +1093,14 @@ void u8g2_Setup_sh1122_i2c_256x64_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x
buf = u8g2_m_32_8_1(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
void u8g2_Setup_sh1122_i2c_256x64_midas_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_sh1122_256x64_midas, u8x8_cad_ssd13xx_i2c, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_1(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* sh1122 2 */
void u8g2_Setup_sh1122_i2c_256x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
Expand All @@ -1078,6 +1110,14 @@ void u8g2_Setup_sh1122_i2c_256x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x
buf = u8g2_m_32_8_2(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
void u8g2_Setup_sh1122_i2c_256x64_midas_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_sh1122_256x64_midas, u8x8_cad_ssd13xx_i2c, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_2(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* sh1122 f */
void u8g2_Setup_sh1122_i2c_256x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
Expand All @@ -1087,6 +1127,14 @@ void u8g2_Setup_sh1122_i2c_256x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x
buf = u8g2_m_32_8_f(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
void u8g2_Setup_sh1122_i2c_256x64_midas_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_sh1122_256x64_midas, u8x8_cad_ssd13xx_i2c, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_f(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* ssd1306 */
/* ssd1306 1 */
void u8g2_Setup_ssd1306_128x32_univision_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
Expand Down Expand Up @@ -2307,6 +2355,62 @@ void u8g2_Setup_ssd1329_128x96_noname_f(u8g2_t *u8g2, const u8g2_cb_t *rotation,
buf = u8g2_m_16_12_f(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation);
}
/* ssd1362 */
/* ssd1362 1 */
void u8g2_Setup_ssd1362_256x64_raystar_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_ssd1362_256x64_raystar, u8x8_cad_001, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_1(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* ssd1362 2 */
void u8g2_Setup_ssd1362_256x64_raystar_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_ssd1362_256x64_raystar, u8x8_cad_001, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_2(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* ssd1362 f */
void u8g2_Setup_ssd1362_256x64_raystar_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_ssd1362_256x64_raystar, u8x8_cad_001, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_f(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* ssd1362 */
/* ssd1362 1 */
void u8g2_Setup_ssd1362_i2c_256x64_raystar_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_ssd1362_256x64_raystar, u8x8_cad_ssd13xx_i2c, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_1(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* ssd1362 2 */
void u8g2_Setup_ssd1362_i2c_256x64_raystar_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_ssd1362_256x64_raystar, u8x8_cad_ssd13xx_i2c, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_2(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* ssd1362 f */
void u8g2_Setup_ssd1362_i2c_256x64_raystar_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
uint8_t tile_buf_height;
uint8_t *buf;
u8g2_SetupDisplay(u8g2, u8x8_d_ssd1362_256x64_raystar, u8x8_cad_ssd13xx_i2c, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_32_8_f(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_horizontal_right_lsb, rotation);
}
/* ld7032 */
/* ld7032 1 */
void u8g2_Setup_ld7032_60x32_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
Expand Down
33 changes: 29 additions & 4 deletions csrc/u8x8.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ typedef struct u8x8_tile_struct u8x8_tile_t;
typedef uint8_t (*u8x8_msg_cb)(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
typedef uint16_t (*u8x8_char_cb)(u8x8_t *u8x8, uint8_t b);



typedef uint8_t (*u8x8_draw_hvtile_cb)(u8x8_t *u8x8, uint8_t tx, uint8_t ty, uint8_t tile_cnt, uint8_t copies, uint8_t tile_buffer_width, uint8_t *tile_ptr);

//struct u8x8_mcd_struct
//{
Expand All @@ -215,6 +214,7 @@ struct u8x8_tile_struct
uint8_t cnt; /* number of tiles */
uint8_t x_pos; /* tile x position */
uint8_t y_pos; /* tile y position */
uint8_t buffer_width; /* tile width of buffer */
};


Expand Down Expand Up @@ -328,6 +328,7 @@ struct u8x8_struct
const u8x8_display_info_t *display_info;
u8x8_char_cb next_cb; /* procedure, which will be used to get the next char from the string */
u8x8_msg_cb display_cb;
u8x8_draw_hvtile_cb draw_hvtile_cb; /* draw hvtile procedure */
u8x8_msg_cb cad_cb;
u8x8_msg_cb byte_cb;
u8x8_msg_cb gpio_and_delay_cb;
Expand Down Expand Up @@ -474,12 +475,13 @@ void u8x8_d_helper_display_init(u8x8_t *u8g2);
/*
Name: U8X8_MSG_DISPLAY_DRAW_TILE
Args:
arg_int: How often to repeat this tile pattern
arg_int: How many copies of this tile pattern
arg_ptr: pointer to u8x8_tile_t
uint8_t *tile_ptr; pointer to one or more tiles (number is "cnt")
uint8_t cnt; number of tiles
uint8_t x_pos; first tile x position
uint8_t y_pos; first tile y position
uint8_t buffer_width tile width of buffer
Tasks:
One tile has exactly 8 bytes (8x8 pixel monochrome bitmap).
The lowest bit of the first byte is the upper left corner
Expand Down Expand Up @@ -531,10 +533,16 @@ uint8_t u8x8_dummy_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
void u8x8_SetupDefaults(u8x8_t *u8x8); /* do not use this, use u8x8_Setup() instead */

void u8x8_Setup(u8x8_t *u8x8, u8x8_msg_cb display_cb, u8x8_msg_cb cad_cb, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
/*
draw_hvtile_cb: one of:
u8x8_draw_hvtile_vertical_top_lsb
u8x8_draw_hvtile_horizontal_right_lsb
*/
void u8x8_SetupTile(u8x8_t *u8x8, u8x8_draw_hvtile_cb draw_hvtile_cb);

/*==========================================*/
/* u8x8_display.c */
uint8_t u8x8_DrawTile(u8x8_t *u8x8, uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_ptr);
uint8_t u8x8_DrawTile(u8x8_t *u8x8, uint8_t tx, uint8_t ty, uint8_t tile_cnt, uint8_t copies, uint8_t tile_buffer_width, uint8_t *tile_ptr);

/*
After a call to u8x8_SetupDefaults,
Expand All @@ -561,7 +569,22 @@ void u8x8_FillDisplay(u8x8_t *u8x8);
void u8x8_RefreshDisplay(u8x8_t *u8x8); // make RAM content visible on the display (Dec 16: SSD1606 only)
void u8x8_ClearLine(u8x8_t *u8x8, uint8_t line);

/*==========================================*/
/* u8x8_draw_hvtile.c */
/*
Called by u8x8 to adjust tile buffer pixel byte orentiation for display.
Vertical or Horizontal stacked
x,y tile position
tile_cnt number of tiles to draw
copies number of copies of tile pattern to draw
tile_buffer_width tile width of buffer being used for drawing
tile_ptr tile buffer
*/

/* SSD13xx, UC17xx, UC16xx */
uint8_t u8x8_draw_hvtile_vertical_top_lsb(u8x8_t *u8x8, uint8_t tx, uint8_t ty, uint8_t tile_cnt, uint8_t copies, uint8_t tile_buffer_width, uint8_t *tile_ptr);
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
uint8_t u8x8_draw_hvtile_horizontal_right_lsb(u8x8_t *u8x8, uint8_t tx, uint8_t ty, uint8_t tile_cnt, uint8_t copies, uint8_t tile_buffer_width, uint8_t *tile_ptr);

/*==========================================*/
/* Command Arg Data (CAD) Interface */
Expand Down Expand Up @@ -823,6 +846,7 @@ uint8_t u8x8_d_sh1107_pimoroni_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_in
uint8_t u8x8_d_sh1107_seeed_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_sh1108_160x160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_sh1122_256x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_sh1122_256x64_midas(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_st7920_192x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_st7920_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1306_2040x16(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
Expand Down Expand Up @@ -901,6 +925,7 @@ uint8_t u8x8_d_ssd1327_ws_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, vo
uint8_t u8x8_d_ssd1327_visionox_128x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1326_er_256x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1329_128x96_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1362_256x64_raystar(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_uc1601_128x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_uc1604_jlx19264(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_uc1608_erc24064(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
Expand Down
21 changes: 14 additions & 7 deletions csrc/u8x8_8x8.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ void u8x8_DrawGlyph(u8x8_t *u8x8, uint8_t x, uint8_t y, uint8_t encoding)
do
{
u8x8_get_glyph_data(u8x8, encoding, buf, tile);
u8x8_DrawTile(u8x8, xx, y, 1, buf);
u8x8->draw_hvtile_cb(u8x8, xx, y, 1/*tile_cnt*/, 1/*copies*/, 1/*tile_buffer_width*/, buf);
// u8x8_DrawTile(u8x8, xx, y, 1, buf);
tile++;
xx++;
} while( xx < th );
Expand Down Expand Up @@ -191,16 +192,20 @@ static void u8x8_draw_2x2_subglyph(u8x8_t *u8x8, uint8_t x, uint8_t y, uint8_t e
buf2[i] = t & 255;
}
u8x8_upscale_buf(buf2, buf);
u8x8_DrawTile(u8x8, x, y, 1, buf);
u8x8->draw_hvtile_cb(u8x8, x, y, 1/*tile_cnt*/, 1/*copies*/, 1/*tile_buffer_width*/, buf);
// u8x8_DrawTile(u8x8, x, y, 1, buf);

u8x8_upscale_buf(buf2+4, buf);
u8x8_DrawTile(u8x8, x+1, y, 1, buf);
u8x8->draw_hvtile_cb(u8x8, x+1, y, 1/*tile_cnt*/, 1/*copies*/, 1/*tile_buffer_width*/, buf);
// u8x8_DrawTile(u8x8, x+1, y, 1, buf);

u8x8_upscale_buf(buf1, buf);
u8x8_DrawTile(u8x8, x, y+1, 1, buf);
u8x8->draw_hvtile_cb(u8x8, x, y+1, 1/*tile_cnt*/, 1/*copies*/, 1/*tile_buffer_width*/, buf);
// u8x8_DrawTile(u8x8, x, y+1, 1, buf);

u8x8_upscale_buf(buf1+4, buf);
u8x8_DrawTile(u8x8, x+1, y+1, 1, buf);
u8x8->draw_hvtile_cb(u8x8, x+1, y+1, 1/*tile_cnt*/, 1/*copies*/, 1/*tile_buffer_width*/, buf);
// u8x8_DrawTile(u8x8, x+1, y+1, 1, buf);
}


Expand Down Expand Up @@ -242,8 +247,10 @@ static void u8x8_draw_1x2_subglyph(u8x8_t *u8x8, uint8_t x, uint8_t y, uint8_t e
buf1[i] = t >> 8;
buf2[i] = t & 255;
}
u8x8_DrawTile(u8x8, x, y, 1, buf2);
u8x8_DrawTile(u8x8, x, y+1, 1, buf1);
u8x8->draw_hvtile_cb(u8x8, x, y, 1/*tile_cnt*/, 1/*copies*/, 1/*tile_buffer_width*/, buf2);
u8x8->draw_hvtile_cb(u8x8, x, y+1, 1/*tile_cnt*/, 1/*copies*/, 1/*tile_buffer_width*/, buf1);
// u8x8_DrawTile(u8x8, x, y, 1, buf2);
// u8x8_DrawTile(u8x8, x, y+1, 1, buf1);
}

void u8x8_Draw1x2Glyph(u8x8_t *u8x8, uint8_t x, uint8_t y, uint8_t encoding)
Expand Down