Skip to content

Commit

Permalink
Refactor description.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
StarQTius committed Nov 24, 2024
1 parent 1f30d27 commit da926f2
Show file tree
Hide file tree
Showing 5 changed files with 532 additions and 308 deletions.
8 changes: 1 addition & 7 deletions example/dynamixel-protocol-2.0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,8 @@ int main() {
auto oit = std::ostream_iterator<std::byte>{std::cout, " "};
std::cout << std::hex;

auto ping_ex1 = description.instantiate(ser,
"id"_kw = 1, "length"_kw = 3, "instruction"_kw = 1);
if (!ping_ex1) {
return (int)ping_ex1.error();
}

std::printf("Ping: example 1\n");
ping_ex1->serialize(ser, oit);
description.encode(("id"_kw = 1, "length"_kw = 3, "instruction"_kw = 1), ser, oit);
std::printf("\n\n");

auto answer1_seq = bytearray{0xff, 0xff, 0xfd, 0x00, 0x01, 0x07, 0x00, 0x55, 0x00, 0x06, 0x04, 0x26, 0x65, 0x5d};
Expand Down
2 changes: 1 addition & 1 deletion include/upd/constexpr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct auto_constant {

constexpr static auto value = Value;

template<typename T>
template<typename T> requires std::convertible_to<value_type, T>
[[nodiscard]] constexpr operator T() const {
return static_cast<T>(value);
}
Expand Down
Loading

0 comments on commit da926f2

Please sign in to comment.