Skip to content

Commit

Permalink
wip test read only rpm
Browse files Browse the repository at this point in the history
Change-Id: Ie80b95b50b330f7f79680f9b854e2321ba13797c
  • Loading branch information
oliverlee committed Jul 27, 2023
1 parent 26d8ee1 commit 8c42763
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion third_party/vesc_uart/src/extra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
#include <cstddef>
#include <cstring>

#include <iostream>

namespace {

static constexpr auto serial_device = 0;

auto payload_buffer = std::array<std::uint8_t, 256>{};

auto cmd_get_values = std::uint8_t{COMM_GET_VALUES};
// try to use COMM_GET_VALUES_SELECTIVE
// constexpr std::uint8_t rpm_bit = 1U << 7;
// auto cmd_get_values = std::uint8_t{COMM_GET_VALUES, rpm_bit, 0x00, 0x00, 0x00};
auto cmd_get_values = std::uint8_t{COMM_GET_VALUES, 0xFF, 0xFF, 0xFF, 0xFF};

} // namespace

Expand All @@ -39,6 +44,8 @@ auto read_payload(std::span<std::uint8_t> buf) -> void
"`buf` is not large enough to hold "
"message");

std::cout << "payload size: " << payload_size << '\n';

const auto message =
std::span{buf.data(), std::size_t(payload_size + footer_size)};
Serial.read(message);
Expand Down

0 comments on commit 8c42763

Please sign in to comment.