Added vertical mirror rotation option.

This commit is contained in:
Matt Nutsch 2021-04-18 11:25:41 -05:00
parent 9ed420b7f2
commit ef42335662
3 changed files with 21 additions and 0 deletions

View File

@ -256,4 +256,6 @@ https://github.com/olikraus/u8g2 ChangeLog
* Added support for KS0713 controller (issue 1314)
* Added support for ST7567_HEM6432 (issue 1159)
* U8g2 16 Bit Mode enabled by default for ARM and ESP Systems (issue 1222)
2021-04-18 v2.28.11 mattnutsch@gmail.com
* Added vertical mirror option for u8g2.

View File

@ -411,12 +411,14 @@ extern const u8g2_cb_t u8g2_cb_r1;
extern const u8g2_cb_t u8g2_cb_r2;
extern const u8g2_cb_t u8g2_cb_r3;
extern const u8g2_cb_t u8g2_cb_mirror;
extern const u8g2_cb_t u8g2_cb_mirror_vertical;
#define U8G2_R0 (&u8g2_cb_r0)
#define U8G2_R1 (&u8g2_cb_r1)
#define U8G2_R2 (&u8g2_cb_r2)
#define U8G2_R3 (&u8g2_cb_r3)
#define U8G2_MIRROR (&u8g2_cb_mirror)
#define U8G2_MIRROR_VERTICAL (&u8g2_cb_mirror_vertical)
/*
u8g2: A new, not yet initialized u8g2 memory areay
buf: Memory are of size tile_buf_height*<width of the display in pixel>

View File

@ -328,6 +328,22 @@ void u8g2_draw_l90_mirrorr_r0(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_u
u8g2_draw_hv_line_2dir(u8g2, xx, y, len, dir);
}
void u8g2_draw_mirror_vertical_r0(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir)
{
u8g2_uint_t yy;
yy = u8g2->height;
yy -= y;
if ( (dir & 1) == 0 )
{
yy -= len;
}
else
{
yy--;
}
u8g2_draw_hv_line_2dir(u8g2, x, yy, len, dir);
}
/* dir = 0 or 1 */
void u8g2_draw_l90_r1(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir)
{
@ -434,6 +450,7 @@ const u8g2_cb_t u8g2_cb_r2 = { u8g2_update_dimension_r2, u8g2_update_page_win_r2
const u8g2_cb_t u8g2_cb_r3 = { u8g2_update_dimension_r3, u8g2_update_page_win_r3, u8g2_draw_l90_r3 };
const u8g2_cb_t u8g2_cb_mirror = { u8g2_update_dimension_r0, u8g2_update_page_win_r0, u8g2_draw_l90_mirrorr_r0 };
const u8g2_cb_t u8g2_cb_mirror_vertical = { u8g2_update_dimension_r0, u8g2_update_page_win_r0, u8g2_draw_mirror_vertical_r0 };
/*============================================*/
/* setup for the null device */