Extend example to use fast lut
This commit is contained in:
parent
061b789319
commit
4d73d7a662
@ -1 +1 @@
|
|||||||
Subproject commit 91b49cd536ea8542908bdfb68a6cb7164128df52
|
Subproject commit 8d8369440c2a3ea25c7c5ca31c16e790746eede0
|
215
eink/main.cpp
215
eink/main.cpp
@ -1,7 +1,11 @@
|
|||||||
#include "clock.hpp"
|
#include "clock.hpp"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "eink/eink.hpp"
|
#include "eink/eink.hpp"
|
||||||
#include "flash/flash.hpp"
|
#include "flash/flash.hpp"
|
||||||
#include "io/io.hpp"
|
#include "io/io.hpp"
|
||||||
@ -15,6 +19,214 @@ REGISTER_UART0_INT_VECTORS(uart_t);
|
|||||||
using spi_t = eink::Spi<io::P::C4, io::P::C5, io::P::C3, io::P::C2>;
|
using spi_t = eink::Spi<io::P::C4, io::P::C5, io::P::C3, io::P::C2>;
|
||||||
using eink_t = eink::Eink<200, 200, spi_t, io::P::C1, io::P::C0>;
|
using eink_t = eink::Eink<200, 200, spi_t, io::P::C1, io::P::C0>;
|
||||||
|
|
||||||
|
using eink::Voltage::VSH1;
|
||||||
|
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 =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
.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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.frameRates = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
|
||||||
|
.subPhaseGateStates = {},
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline constexpr auto createFastWaveformLut(const eink::Waveform &original)
|
||||||
|
{
|
||||||
|
auto fastWaveformLut = original;
|
||||||
|
|
||||||
|
for (auto &timing : fastWaveformLut.timings) {
|
||||||
|
timing.repeatSubPhaseAB = 0;
|
||||||
|
timing.repeatSubPhaseCD = 0;
|
||||||
|
timing.repeat = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fastWaveformLut;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr auto FAST_WAVEFORM_LUT [[gnu::progmem]] = createFastWaveformLut(ORIGINAL_WAVEFORM_LUT);
|
||||||
|
|
||||||
void dumpOTP(eink_t &einkDisplay, uart_t &serial)
|
void dumpOTP(eink_t &einkDisplay, uart_t &serial)
|
||||||
{
|
{
|
||||||
constexpr auto printWidth = 16;
|
constexpr auto printWidth = 16;
|
||||||
@ -59,6 +271,9 @@ int main()
|
|||||||
serial << F("e-Paper clear") << F("\r\n");
|
serial << F("e-Paper clear") << F("\r\n");
|
||||||
einkDisplay.clear();
|
einkDisplay.clear();
|
||||||
|
|
||||||
|
serial << F("e-Paper draw fast") << F("\r\n");
|
||||||
|
einkDisplay.draw(RLE_IMAGE, FAST_WAVEFORM_LUT);
|
||||||
|
|
||||||
serial << F("e-Paper draw") << F("\r\n");
|
serial << F("e-Paper draw") << F("\r\n");
|
||||||
einkDisplay.draw(RLE_IMAGE);
|
einkDisplay.draw(RLE_IMAGE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user