Files
hexapod-robot/2026-current/robot/Comms.h
T

20 lines
644 B
C++
Raw Normal View History

#pragma once
#include <Arduino.h>
#include <HexapodProtocol.h> // CmdPacket + FLAG_* + radio settings, shared with the remote (shared/)
class Comms {
public:
bool begin();
void update(); // call every loop; polls the radio if present
bool linkOk() const { return link_ok_; }
const CmdPacket& latest() const { return packet_; }
// Lets the serial test harness (or, later, real radio) inject a packet directly.
void injectPacket(const CmdPacket& p) { packet_ = p; last_rx_ms_ = millis(); }
private:
CmdPacket packet_;
uint32_t last_rx_ms_ = 0;
bool link_ok_ = false;
bool radio_present_ = false;
};