Skip to content

Commit

Permalink
wip: vertical mirroring support
Browse files Browse the repository at this point in the history
  • Loading branch information
vroland committed Dec 10, 2024
1 parent 2591847 commit 8f13113
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/displays.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const EpdDisplay_t ED060SCT = {
.height = 600,
.bus_width = 8,
.bus_speed = 20,
.mirror_vertically = false,
.default_waveform = &epdiy_ED060SCT,
.display_type = DISPLAY_TYPE_GENERIC,
};
Expand All @@ -14,6 +15,7 @@ const EpdDisplay_t ED060XC3 = {
.height = 768,
.bus_width = 8,
.bus_speed = 20,
.mirror_vertically = false,
.default_waveform = &epdiy_ED060XC3,
.display_type = DISPLAY_TYPE_GENERIC,
};
Expand All @@ -23,6 +25,7 @@ const EpdDisplay_t ED097OC4 = {
.height = 825,
.bus_width = 8,
.bus_speed = 15,
.mirror_vertically = false,
.default_waveform = &epdiy_ED097OC4,
.display_type = DISPLAY_TYPE_GENERIC,
};
Expand All @@ -32,6 +35,7 @@ const EpdDisplay_t ED097TC2 = {
.height = 825,
.bus_width = 8,
.bus_speed = 22,
.mirror_vertically = false,
.default_waveform = &epdiy_ED097TC2,
.display_type = DISPLAY_TYPE_ED097TC2,
};
Expand All @@ -41,6 +45,7 @@ const EpdDisplay_t ED133UT2 = {
.height = 1200,
.bus_width = 8,
.bus_speed = 20,
.mirror_vertically = false,
.default_waveform = &epdiy_ED097TC2,
.display_type = DISPLAY_TYPE_ED097TC2,
};
Expand All @@ -50,6 +55,7 @@ const EpdDisplay_t ED047TC1 = {
.height = 540,
.bus_width = 8,
.bus_speed = 20,
.mirror_vertically = false,
.default_waveform = &epdiy_ED047TC1,
.display_type = DISPLAY_TYPE_GENERIC,
};
Expand All @@ -59,6 +65,7 @@ const EpdDisplay_t ED047TC2 = {
.height = 540,
.bus_width = 8,
.bus_speed = 20,
.mirror_vertically = false,
.default_waveform = &epdiy_ED047TC2,
.display_type = DISPLAY_TYPE_GENERIC,
};
Expand All @@ -68,6 +75,17 @@ const EpdDisplay_t ED078KC1 = {
.height = 1404,
.bus_width = 16,
.bus_speed = 11,
.mirror_vertically = false,
.default_waveform = &epdiy_ED047TC2,
.display_type = DISPLAY_TYPE_GENERIC,
};

const EpdDisplay_t ED068TG1 = {
.width = 1440,
.height = 1080,
.bus_width = 16,
.bus_speed = 11,
.mirror_vertically = true,
.default_waveform = &epdiy_ED047TC2,
.display_type = DISPLAY_TYPE_GENERIC,
};
4 changes: 4 additions & 0 deletions src/epd_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ typedef struct {
/// (Only used by the LCD based renderer in V7+)
int bus_speed;

/// Changes behaviour of draw functions if the display draws bottom to top
bool mirror_vertically;

/// Default waveform to use.
const EpdWaveform* default_waveform;
/// Display type
Expand All @@ -39,4 +42,5 @@ extern const EpdDisplay_t ED097TC2;
extern const EpdDisplay_t ED133UT2;
extern const EpdDisplay_t ED047TC1;
extern const EpdDisplay_t ED047TC2;
extern const EpdDisplay_t ED068TG1;
extern const EpdDisplay_t ED078KC1;
3 changes: 3 additions & 0 deletions src/epdiy.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Coord_xy _rotate(uint16_t x, uint16_t y) {
y = epd_height() - y - 1;
break;
}
if (epd_get_display()->mirror_vertically) {
y = epd_height() - y - 1;
}
Coord_xy coord = { x, y };
return coord;
}
Expand Down

0 comments on commit 8f13113

Please sign in to comment.