Implement OTP dumping
This commit is contained in:
Submodule eink/eink updated: 7a0f00ceab...91b49cd536
@@ -224,6 +224,9 @@
|
|||||||
<Compile Include="eink\eink.hpp">
|
<Compile Include="eink\eink.hpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="eink\otp.hpp">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="flash\flash.hpp">
|
<Compile Include="flash\flash.hpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
Submodule eink/flash updated: 6edb2e5a21...f9014aea6c
@@ -1,5 +1,7 @@
|
|||||||
#include "clock.hpp"
|
#include "clock.hpp"
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "eink/eink.hpp"
|
#include "eink/eink.hpp"
|
||||||
#include "flash/flash.hpp"
|
#include "flash/flash.hpp"
|
||||||
#include "io/io.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 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>;
|
||||||
|
|
||||||
|
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()
|
int main()
|
||||||
{
|
{
|
||||||
uart_t serial;
|
uart_t serial;
|
||||||
@@ -33,6 +62,9 @@ int main()
|
|||||||
serial << F("e-Paper draw") << F("\r\n");
|
serial << F("e-Paper draw") << F("\r\n");
|
||||||
einkDisplay.draw(RLE_IMAGE);
|
einkDisplay.draw(RLE_IMAGE);
|
||||||
|
|
||||||
|
serial << F("e-Paper dump OTP") << F("\r\n");
|
||||||
|
dumpOTP(einkDisplay, serial);
|
||||||
|
|
||||||
serial << F("e-Paper sleep") << F("\r\n");
|
serial << F("e-Paper sleep") << F("\r\n");
|
||||||
einkDisplay.sleep();
|
einkDisplay.sleep();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user