diff --git a/eink/eink b/eink/eink index 8d83694..3d45d2a 160000 --- a/eink/eink +++ b/eink/eink @@ -1 +1 @@ -Subproject commit 8d8369440c2a3ea25c7c5ca31c16e790746eede0 +Subproject commit 3d45d2a4b393724f3eb618d49936adc7ee168d1b diff --git a/eink/flash b/eink/flash index f9014ae..ceec87f 160000 --- a/eink/flash +++ b/eink/flash @@ -1 +1 @@ -Subproject commit f9014aea6cbbb1ea76f30148a64e6c3fc3152dcd +Subproject commit ceec87f9219c1a380ff29dd93545d2596d9c8165 diff --git a/eink/image.hpp b/eink/image.hpp index f3bc577..edf94fb 100644 --- a/eink/image.hpp +++ b/eink/image.hpp @@ -6,7 +6,9 @@ #include -constexpr auto RLE_IMAGE [[gnu::progmem]] = std::tuple{ +#include "flash/flash.hpp" + +constexpr auto RLE_IMAGE = flash::Wrapper{std::tuple{ std::to_array>({ {255, 0xff}, {17, 0xff}, {1, 0x0f}, {3, 0xff}, {1, 0xc0}, {2, 0x00}, {1, 0x01}, {7, 0xff}, {1, 0xfe}, {1, 0x07}, {1, 0xf0}, {1, 0x3f}, {2, 0xff}, {1, 0xfe}, {1, 0x07}, {1, 0xf0}, {1, 0x3e}, {1, 0x07}, @@ -283,4 +285,4 @@ constexpr auto RLE_IMAGE [[gnu::progmem]] = std::tuple{ {22, 0xff}, {1, 0xfe}, {1, 0x00}, {1, 0x3f}, {23, 0xff}, {1, 0x81}, {255, 0xff}, {255, 0xff}, {255, 0xff}, {255, 0xff}, {81, 0xff}, }), -}; +}}; diff --git a/eink/main.cpp b/eink/main.cpp index 034d4ea..9dd37d0 100644 --- a/eink/main.cpp +++ b/eink/main.cpp @@ -24,197 +24,198 @@ using eink::Voltage::VSH2; using eink::Voltage::VSL1; using eink::Voltage::VSS1; -constexpr auto ORIGINAL_WAVEFORM_LUT - [[gnu::progmem]] = - eink::Waveform{ - .lut = {{{ - {.phaseD = VSH1, .phaseC = VSH1, .phaseB = VSS1, .phaseA = VSH1}, - {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSL1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSH1}, - }}, - {{ - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSL1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSS1, .phaseC = VSL1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSL1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - }}, - {{ - {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSL1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSH1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSH2, .phaseC = VSL1, .phaseB = VSL1, .phaseA = VSS1}, - {.phaseD = VSH2, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSL1}, - {.phaseD = VSH2, .phaseC = VSH2, .phaseB = VSH2, .phaseA = VSL1}, - {.phaseD = VSS1, .phaseC = VSH2, .phaseB = VSH2, .phaseA = VSH2}, - }}, - {{ - {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSL1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSH1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSH2, .phaseC = VSL1, .phaseB = VSL1, .phaseA = VSS1}, - {.phaseD = VSH2, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSL1}, - {.phaseD = VSH2, .phaseC = VSH2, .phaseB = VSH2, .phaseA = VSL1}, - {.phaseD = VSS1, .phaseC = VSH2, .phaseB = VSH2, .phaseA = VSH2}, - }}, - {{ - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, - }}}, - .timings = - { +constexpr auto + ORIGINAL_WAVEFORM_LUT = + flash::Wrapper{ + eink::Waveform{ + .lut = {{{ + {.phaseD = VSH1, .phaseC = VSH1, .phaseB = VSS1, .phaseA = VSH1}, + {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSL1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSH1}, + }}, + {{ + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSL1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSS1, .phaseC = VSL1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSL1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + }}, + {{ + {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSL1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSH1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSH2, .phaseC = VSL1, .phaseB = VSL1, .phaseA = VSS1}, + {.phaseD = VSH2, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSL1}, + {.phaseD = VSH2, .phaseC = VSH2, .phaseB = VSH2, .phaseA = VSL1}, + {.phaseD = VSS1, .phaseC = VSH2, .phaseB = VSH2, .phaseA = VSH2}, + }}, + {{ + {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSL1, .phaseC = VSL1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSL1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSH1, .phaseC = VSH1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSH1, .phaseA = VSL1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSH2, .phaseC = VSL1, .phaseB = VSL1, .phaseA = VSS1}, + {.phaseD = VSH2, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSL1}, + {.phaseD = VSH2, .phaseC = VSH2, .phaseB = VSH2, .phaseA = VSL1}, + {.phaseD = VSS1, .phaseC = VSH2, .phaseB = VSH2, .phaseA = VSH2}, + }}, + {{ + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSL1, .phaseA = VSH1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + {.phaseD = VSS1, .phaseC = VSS1, .phaseB = VSS1, .phaseA = VSS1}, + }}}, + .timings = { - .frameCountPhaseA = 32, - .frameCountPhaseB = 16, - .repeatSubPhaseAB = 0, - .frameCountPhaseC = 19, - .frameCountPhaseD = 20, - .repeatSubPhaseCD = 0, - .repeat = 0, + { + .frameCountPhaseA = 32, + .frameCountPhaseB = 16, + .repeatSubPhaseAB = 0, + .frameCountPhaseC = 19, + .frameCountPhaseD = 20, + .repeatSubPhaseCD = 0, + .repeat = 0, + }, + { + .frameCountPhaseA = 3, + .frameCountPhaseB = 3, + .repeatSubPhaseAB = 6, + .frameCountPhaseC = 12, + .frameCountPhaseD = 10, + .repeatSubPhaseCD = 0, + .repeat = 0, + }, + { + .frameCountPhaseA = 3, + .frameCountPhaseB = 4, + .repeatSubPhaseAB = 0, + .frameCountPhaseC = 3, + .frameCountPhaseD = 4, + .repeatSubPhaseCD = 0, + .repeat = 10, + }, + { + .frameCountPhaseA = 3, + .frameCountPhaseB = 3, + .repeatSubPhaseAB = 10, + .frameCountPhaseC = 22, + .frameCountPhaseD = 2, + .repeatSubPhaseCD = 0, + .repeat = 0, + }, + { + .frameCountPhaseA = 3, + .frameCountPhaseB = 3, + .repeatSubPhaseAB = 3, + .frameCountPhaseC = 0, + .frameCountPhaseD = 0, + .repeatSubPhaseCD = 0, + .repeat = 0, + }, + { + .frameCountPhaseA = 2, + .frameCountPhaseB = 2, + .repeatSubPhaseAB = 3, + .frameCountPhaseC = 5, + .frameCountPhaseD = 5, + .repeatSubPhaseCD = 1, + .repeat = 0, + }, + { + .frameCountPhaseA = 22, + .frameCountPhaseB = 20, + .repeatSubPhaseAB = 0, + .frameCountPhaseC = 20, + .frameCountPhaseD = 0, + .repeatSubPhaseCD = 0, + .repeat = 0, + }, + { + .frameCountPhaseA = 0, + .frameCountPhaseB = 0, + .repeatSubPhaseAB = 0, + .frameCountPhaseC = 0, + .frameCountPhaseD = 0, + .repeatSubPhaseCD = 0, + .repeat = 0, + }, + { + .frameCountPhaseA = 4, + .frameCountPhaseB = 5, + .repeatSubPhaseAB = 0, + .frameCountPhaseC = 3, + .frameCountPhaseD = 40, + .repeatSubPhaseCD = 0, + .repeat = 2, + }, + { + .frameCountPhaseA = 2, + .frameCountPhaseB = 3, + .repeatSubPhaseAB = 0, + .frameCountPhaseC = 3, + .frameCountPhaseD = 50, + .repeatSubPhaseCD = 0, + .repeat = 1, + }, + { + .frameCountPhaseA = 6, + .frameCountPhaseB = 3, + .repeatSubPhaseAB = 0, + .frameCountPhaseC = 34, + .frameCountPhaseD = 5, + .repeatSubPhaseCD = 0, + .repeat = 0, + }, + { + .frameCountPhaseA = 4, + .frameCountPhaseB = 5, + .repeatSubPhaseAB = 0, + .frameCountPhaseC = 5, + .frameCountPhaseD = 1, + .repeatSubPhaseCD = 0, + .repeat = 0, + }, }, - { - .frameCountPhaseA = 3, - .frameCountPhaseB = 3, - .repeatSubPhaseAB = 6, - .frameCountPhaseC = 12, - .frameCountPhaseD = 10, - .repeatSubPhaseCD = 0, - .repeat = 0, - }, - { - .frameCountPhaseA = 3, - .frameCountPhaseB = 4, - .repeatSubPhaseAB = 0, - .frameCountPhaseC = 3, - .frameCountPhaseD = 4, - .repeatSubPhaseCD = 0, - .repeat = 10, - }, - { - .frameCountPhaseA = 3, - .frameCountPhaseB = 3, - .repeatSubPhaseAB = 10, - .frameCountPhaseC = 22, - .frameCountPhaseD = 2, - .repeatSubPhaseCD = 0, - .repeat = 0, - }, - { - .frameCountPhaseA = 3, - .frameCountPhaseB = 3, - .repeatSubPhaseAB = 3, - .frameCountPhaseC = 0, - .frameCountPhaseD = 0, - .repeatSubPhaseCD = 0, - .repeat = 0, - }, - { - .frameCountPhaseA = 2, - .frameCountPhaseB = 2, - .repeatSubPhaseAB = 3, - .frameCountPhaseC = 5, - .frameCountPhaseD = 5, - .repeatSubPhaseCD = 1, - .repeat = 0, - }, - { - .frameCountPhaseA = 22, - .frameCountPhaseB = 20, - .repeatSubPhaseAB = 0, - .frameCountPhaseC = 20, - .frameCountPhaseD = 0, - .repeatSubPhaseCD = 0, - .repeat = 0, - }, - { - .frameCountPhaseA = 0, - .frameCountPhaseB = 0, - .repeatSubPhaseAB = 0, - .frameCountPhaseC = 0, - .frameCountPhaseD = 0, - .repeatSubPhaseCD = 0, - .repeat = 0, - }, - { - .frameCountPhaseA = 4, - .frameCountPhaseB = 5, - .repeatSubPhaseAB = 0, - .frameCountPhaseC = 3, - .frameCountPhaseD = 40, - .repeatSubPhaseCD = 0, - .repeat = 2, - }, - { - .frameCountPhaseA = 2, - .frameCountPhaseB = 3, - .repeatSubPhaseAB = 0, - .frameCountPhaseC = 3, - .frameCountPhaseD = 50, - .repeatSubPhaseCD = 0, - .repeat = 1, - }, - { - .frameCountPhaseA = 6, - .frameCountPhaseB = 3, - .repeatSubPhaseAB = 0, - .frameCountPhaseC = 34, - .frameCountPhaseD = 5, - .repeatSubPhaseCD = 0, - .repeat = 0, - }, - { - .frameCountPhaseA = 4, - .frameCountPhaseB = 5, - .repeatSubPhaseAB = 0, - .frameCountPhaseC = 5, - .frameCountPhaseD = 1, - .repeatSubPhaseCD = 0, - .repeat = 0, - }, - }, - .frameRates = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - .subPhaseGateStates = {}, - }; + .frameRates = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + .subPhaseGateStates = {}, + }}; -static inline constexpr auto createFastWaveformLut(const eink::Waveform &original) +static inline consteval auto createFastWaveformLut(const flash::Wrapper &original) { - auto fastWaveformLut = original; + auto fastWaveformLut = original.value; for (auto &timing : fastWaveformLut.timings) { timing.repeatSubPhaseAB = 0; @@ -222,10 +223,10 @@ static inline constexpr auto createFastWaveformLut(const eink::Waveform &origina timing.repeat = 0; } - return fastWaveformLut; + return flash::Wrapper{fastWaveformLut}; } -constexpr auto FAST_WAVEFORM_LUT [[gnu::progmem]] = createFastWaveformLut(ORIGINAL_WAVEFORM_LUT); +constexpr auto FAST_WAVEFORM_LUT = createFastWaveformLut(ORIGINAL_WAVEFORM_LUT); void dumpOTP(eink_t &einkDisplay, uart_t &serial) {