changed serial reading from lowlevel to boost with hope for more stability, changed a lot of smart pointers to unique_ptr, added fmt for logging
This commit is contained in:
31
datatypes.h
Normal file
31
datatypes.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef DATATYPES_H
|
||||
#define DATATYPES_H
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
struct TransStruct {
|
||||
uint16_t time;
|
||||
uint8_t id;
|
||||
uint8_t update;
|
||||
};
|
||||
|
||||
struct TransCheck {
|
||||
char begin;
|
||||
struct TransStruct data[6];
|
||||
char end;
|
||||
};
|
||||
|
||||
template <> struct fmt::formatter<TransStruct> {
|
||||
template <typename ParseContext> constexpr auto parse(ParseContext & ctx) {
|
||||
return ctx.begin();
|
||||
}
|
||||
|
||||
template <typename FormatContext>
|
||||
auto format(const TransStruct & t, FormatContext & ctx) {
|
||||
return format_to(ctx.out(), "id {}; time {}; update {}", t.id, t.time,
|
||||
t.update);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // DATATYPES_H
|
||||
Reference in New Issue
Block a user