Allow image and LUT to be located either in ram or flash

This commit is contained in:
BlackMark 2022-06-03 16:55:24 +02:00
parent 4d73d7a662
commit 3599979cc4
4 changed files with 196 additions and 193 deletions

@ -1 +1 @@
Subproject commit 8d8369440c2a3ea25c7c5ca31c16e790746eede0
Subproject commit 3d45d2a4b393724f3eb618d49936adc7ee168d1b

@ -1 +1 @@
Subproject commit f9014aea6cbbb1ea76f30148a64e6c3fc3152dcd
Subproject commit ceec87f9219c1a380ff29dd93545d2596d9c8165

View File

@ -6,7 +6,9 @@
#include <cstdint>
constexpr auto RLE_IMAGE [[gnu::progmem]] = std::tuple{
#include "flash/flash.hpp"
constexpr auto RLE_IMAGE = flash::Wrapper{std::tuple{
std::to_array<std::pair<std::uint8_t, std::uint8_t>>({
{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},
}),
};
}};

View File

@ -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>{
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<eink::Waveform> &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)
{