Skip to content

Commit

Permalink
Read values from VESC motor controller
Browse files Browse the repository at this point in the history
Change-Id: Icaad5bd270827f1fa1b22a77d0cd0e23dbf999e5
  • Loading branch information
oliverlee committed Jul 27, 2023
1 parent 8d86f57 commit 8e46e4d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
cc_binary(
name = "vesc_cmd",
srcs = ["vesc_cmd.cpp"],
deps = ["//third_party/vesc_uart"],
deps = [
"//third_party/vesc_uart",
"@fmt",
],
)

cc_binary(
Expand Down
11 changes: 11 additions & 0 deletions examples/vesc_cmd.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
#include "third_party/vesc_uart/VescUart.h"
//#include ""

#include <cstdint>
#include <fmt/core.h>

auto main() -> int
{
::VescUartSetCurrent(1.0F);

auto cmd_get_values = std::uint8_t{ COMM_GET_VALUES };
constexpr auto serial_device = 0;
::PackSendPayload(&cmd_get_values, sizeof(cmd_get_values), serial_device);

const auto len_payload = Serial.read();
fmt::print("len payload: {}\n", len_payload);

return 0;
}
2 changes: 1 addition & 1 deletion uart_abstraction/HardwareSerial.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Fake API for UART read/write.
// API for UART read/write.

#pragma once

Expand Down

0 comments on commit 8e46e4d

Please sign in to comment.