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

Custom page selection for paged display #990

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add method for selecting another than the first page as to be able to…
… update only a vertical section of the display without affecting the rest.
  • Loading branch information
JohannesWilde committed Sep 8, 2019
commit 1cbbf6e20b5c8f78d936645dd6ffd80cbee53aab
1 change: 1 addition & 0 deletions csrc/u8g2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,7 @@ void u8g2_ClearBuffer(u8g2_t *u8g2);

void u8g2_SetBufferCurrTileRow(u8g2_t *u8g2, uint8_t row) U8G2_NOINLINE;

uint8_t u8g2_CustomPage(u8g2_t * const u8g2, uint8_t const page);
void u8g2_FirstPage(u8g2_t *u8g2);
uint8_t u8g2_NextPage(u8g2_t *u8g2);

Expand Down
23 changes: 23 additions & 0 deletions csrc/u8g2_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ void u8g2_SetBufferCurrTileRow(u8g2_t *u8g2, uint8_t row)
u8g2->cb->update_page_win(u8g2);
}

uint8_t u8g2_PageFirstRow(u8g2_t const * const u8g2, uint8_t const page)
{
return u8g2->tile_buf_height * page;
}

uint8_t u8g2_CustomPage(u8g2_t * const u8g2, uint8_t const page)
{
uint8_t const row = u8g2_PageFirstRow(u8g2, page);
if ( row >= u8g2_GetU8x8(u8g2)->display_info->tile_height )
{
return 0;
}
else
{
if ( u8g2->is_auto_page_clear )
{
u8g2_ClearBuffer(u8g2);
}
u8g2_SetBufferCurrTileRow(u8g2, row);
return 1;
}
}

void u8g2_FirstPage(u8g2_t *u8g2)
{
if ( u8g2->is_auto_page_clear )
Expand Down