[hal] Add no throw/error version of CAN Write methods (#2063)

This commit is contained in:
Thad House
2020-08-29 23:07:22 -07:00
committed by GitHub
parent 7c99224bb7
commit ed18693345
5 changed files with 147 additions and 2 deletions

View File

@@ -93,6 +93,38 @@ class CAN : public ErrorBase {
*/
void WriteRTRFrame(int length, int apiId);
/**
* Write a packet to the CAN device with a specific ID. This ID is 10 bits.
*
* @param data The data to write (8 bytes max)
* @param length The data length to write
* @param apiId The API ID to write.
*/
int WritePacketNoError(const uint8_t* data, int length, int apiId);
/**
* Write a repeating packet to the CAN device with a specific ID. This ID is
* 10 bits. The RoboRIO will automatically repeat the packet at the specified
* interval
*
* @param data The data to write (8 bytes max)
* @param length The data length to write
* @param apiId The API ID to write.
* @param repeatMs The period to repeat the packet at.
*/
int WritePacketRepeatingNoError(const uint8_t* data, int length, int apiId,
int repeatMs);
/**
* Write an RTR frame to the CAN device with a specific ID. This ID is 10
* bits. The length by spec must match what is returned by the responding
* device
*
* @param length The length to request (0 to 8)
* @param apiId The API ID to write.
*/
int WriteRTRFrameNoError(int length, int apiId);
/**
* Stop a repeating packet with a specific ID. This ID is 10 bits.
*