Implement OTP dumping
This commit is contained in:
parent
fbc40cbab9
commit
061b789319
@ -1 +1 @@
|
||||
Subproject commit 7a0f00ceab04f291596d0c1064e64833b4f7a280
|
||||
Subproject commit 91b49cd536ea8542908bdfb68a6cb7164128df52
|
@ -224,6 +224,9 @@
|
||||
<Compile Include="eink\eink.hpp">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="eink\otp.hpp">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="flash\flash.hpp">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 6edb2e5a21e0ce58ff2df936caee8b84e240a46b
|
||||
Subproject commit f9014aea6cbbb1ea76f30148a64e6c3fc3152dcd
|
@ -1,5 +1,7 @@
|
||||
#include "clock.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "eink/eink.hpp"
|
||||
#include "flash/flash.hpp"
|
||||
#include "io/io.hpp"
|
||||
@ -13,6 +15,33 @@ REGISTER_UART0_INT_VECTORS(uart_t);
|
||||
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>;
|
||||
|
||||
void dumpOTP(eink_t &einkDisplay, uart_t &serial)
|
||||
{
|
||||
constexpr auto printWidth = 16;
|
||||
auto printedCnt = std::size_t{0};
|
||||
|
||||
einkDisplay.dumpOTP([&serial, &printedCnt](const auto &data) {
|
||||
constexpr auto printAddress = true;
|
||||
|
||||
if (printedCnt > 0 && printedCnt % printWidth == 0) {
|
||||
serial << F("\r\n");
|
||||
}
|
||||
|
||||
if (printAddress && printedCnt % printWidth == 0) {
|
||||
serial << F("0x");
|
||||
serial.txNumber<std::size_t, 16, 4>(printedCnt);
|
||||
serial << F(": ");
|
||||
}
|
||||
|
||||
serial << F("0x");
|
||||
serial.txNumber<std::remove_cvref_t<decltype(data)>, 16, 2>(data);
|
||||
serial << F(", ");
|
||||
|
||||
++printedCnt;
|
||||
});
|
||||
serial << F("\r\n");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
uart_t serial;
|
||||
@ -33,6 +62,9 @@ int main()
|
||||
serial << F("e-Paper draw") << F("\r\n");
|
||||
einkDisplay.draw(RLE_IMAGE);
|
||||
|
||||
serial << F("e-Paper dump OTP") << F("\r\n");
|
||||
dumpOTP(einkDisplay, serial);
|
||||
|
||||
serial << F("e-Paper sleep") << F("\r\n");
|
||||
einkDisplay.sleep();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user