expand and fix digitalIO class

This commit is contained in:
Emanuele Trabattoni
2025-07-24 13:51:21 +02:00
parent 71c7ff8756
commit 07dd200de8
12 changed files with 403 additions and 81 deletions

View File

@@ -1,5 +1,6 @@
#include "utils.h"
void printBytes(const char title[], const std::vector<uint8_t> &b)
{
Serial0.flush();
@@ -18,20 +19,32 @@ void printBytes(const char title[], const std::vector<uint16_t> &b)
printf("%s: ", title);
for (auto v : b)
{
printf("0x%04x ", v);
}
printf("\n");
Serial0.flush();
printf("0x%04x ", v);
}
printf("\n");
Serial0.flush();
}
void printBool(const char title[], const std::vector<bool> &vals)
{
Serial0.flush();
printf("%s: ", title);
for (auto j(0); j < vals.size(); j++)
{
printf("%s ", vals.at(j) ? "True" : "False");
}
printf("\n");
Serial0.flush();
Serial0.flush();
printf("%s: ", title);
for (auto j(0); j < vals.size(); j++)
{
printf("%s ", vals.at(j) ? "True" : "False");
}
printf("\n");
Serial0.flush();
}
const std::string printBoolVec(const std::vector<bool> &vals)
{
std::string buf;
buf.reserve(vals.size()+1);
buf.append("b");
for (const auto v : vals)
{
buf.append(v ? "1" : "0");
}
return buf;
}