improved bus wait with raii class that updates last access
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
void printBytes(const char title[], const std::vector<uint8_t> &b)
|
||||
{
|
||||
Serial0.flush();
|
||||
@@ -40,7 +39,7 @@ void printBool(const char title[], const std::vector<bool> &vals)
|
||||
const std::string printBoolVec(const std::vector<bool> &vals)
|
||||
{
|
||||
std::string buf;
|
||||
buf.reserve(vals.size()+1);
|
||||
buf.reserve(vals.size() + 1);
|
||||
buf.append("b");
|
||||
for (const auto v : vals)
|
||||
{
|
||||
@@ -48,3 +47,17 @@ const std::string printBoolVec(const std::vector<bool> &vals)
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
const std::string printHex(const uint8_t val)
|
||||
{
|
||||
std::string buf(5, '\0');
|
||||
sprintf(buf.data(), "0x%02x", val);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const std::string printHex(const uint16_t val)
|
||||
{
|
||||
std::string buf(7, '\0');
|
||||
sprintf(buf.data(), "0x%04x", val);
|
||||
return buf;
|
||||
}
|
||||
Reference in New Issue
Block a user