|
AndyMark FRC CAN API (C++) v2026.0.4
|
Common base abstraction for AndyMark CAN devices. More...
#include <AMCanDevice.h>
Public Member Functions | |
| CanDevice (int deviceID, int deviceManufacturer, int deviceType) | |
| Construct a CAN device wrapper. | |
| virtual | ~CanDevice ()=default |
| Virtual destructor. | |
| int | getDeviceId () |
| Get this device's configured CAN ID. | |
| void | RestartDevice () |
| Request a device reboot via CAN command. | |
Protected Member Functions | |
| void | SendCANMessage (int apiID, const uint8_t *data, int length) |
| Low-level helper to transmit a CAN packet. | |
| bool | ReceiveCANMessage (int apiID, frc::CANData *, int timeoutMs) |
| Receive a packet with a specific API ID, optionally waiting up to timeout. | |
Protected Attributes | |
| frc::CAN | m_can |
| int | m_deviceID |
| int | deviceManufacturer |
| int | deviceType |
Common base abstraction for AndyMark CAN devices.
Construct with a device ID, manufacturer, and device type. Provides protected helpers to send/receive raw CAN packets and public utility methods.
|
explicit |
Construct a CAN device wrapper.
| deviceID | The 6-bit/8-bit device ID on the CAN bus. |
| deviceManufacturer | 8-bit manufacturer code (e.g., 15 for AndyMark). |
| deviceType | Device type identifier (matches on-device firmware). |
|
virtualdefault |
Virtual destructor.
Necessary for correct cleanup through base pointers.
| int CanDevice::getDeviceId | ( | ) |
Get this device's configured CAN ID.
|
protected |
Receive a packet with a specific API ID, optionally waiting up to timeout.
Wraps WPILib frc::CAN::ReadPacketTimeout.
| apiID | Expected API ID to match. |
| frc::CANData* | Destination structure for received data. |
| timeoutMs | Maximum time to wait for a packet (milliseconds). |
| void CanDevice::RestartDevice | ( | ) |
Request a device reboot via CAN command.
Sends a vendor-specific API frame defined by RESTART_DEVICE_API.
|
protected |
Low-level helper to transmit a CAN packet.
| apiID | Vendor-specific API ID used to route the message. |
| data | Pointer to payload bytes (may be nullptr when length==0). |
| length | Number of payload bytes (0..8). |
|
protected |
Manufacturer code (8-bit).
|
protected |
Device type identifier.
|
protected |
Underlying WPILib CAN endpoint.
|
protected |
Configured CAN device ID.