2#include "core/device/cobs_device.h"
3#include "core/device/vdb/protocol.hpp"
11class Device :
public VDP::AbstractDevice,
public COBSSerialDevice {
13 static constexpr int32_t NO_ACTIVITY_DELAY = 2;
14 static constexpr std::size_t MAX_OUT_QUEUE_SIZE = 50;
15 static constexpr std::size_t MAX_IN_QUEUE_SIZE = 50;
21 explicit Device(int32_t port, int32_t baud_rate);
23 bool send_packet(
const VDP::Packet &packet);
28 void register_receive_callback(std::function<
void(
const VDP::Packet &packet)> callback
36 std::deque<WirePacket> outbound_packets{};
37 vex::mutex outbound_mutex;
42 std::deque<WirePacket> inbound_packets;
44 vex::mutex inbound_mutex;
49 WirePacket inbound_buffer;
53 static int decode_thread(
void *self);
58 static int serial_thread(
void *self);
60 bool write_packet_if_avail();
63 vex::task serial_task;
66 std::function<void(
const VDP::Packet &packet)> callback;
Definition protocol.hpp:13