mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
Moved C++ comments from source files to headers (#1111)
Also sorted functions in C++ sources to match order in related headers.
This commit is contained in:
committed by
Peter Johnson
parent
d9971a705a
commit
8c680a26f8
@@ -33,17 +33,92 @@ struct CANData {
|
||||
*/
|
||||
class CAN : public ErrorBase {
|
||||
public:
|
||||
/**
|
||||
* Create a new CAN communication interface with the specific device ID.
|
||||
* The device ID is 6 bits (0-63)
|
||||
*/
|
||||
explicit CAN(int deviceId);
|
||||
|
||||
/**
|
||||
* Closes the CAN communication.
|
||||
*/
|
||||
~CAN() override;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
void WritePacket(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.
|
||||
*/
|
||||
void WritePacketRepeating(const uint8_t* data, int length, int apiId,
|
||||
int repeatMs);
|
||||
|
||||
/**
|
||||
* Stop a repeating packet with a specific ID. This ID is 10 bits.
|
||||
*
|
||||
* @param apiId The API ID to stop repeating
|
||||
*/
|
||||
void StopPacketRepeating(int apiId);
|
||||
|
||||
/**
|
||||
* Read a new CAN packet. This will only return properly once per packet
|
||||
* received. Multiple calls without receiving another packet will return
|
||||
* false.
|
||||
*
|
||||
* @param apiId The API ID to read.
|
||||
* @param data Storage for the received data.
|
||||
* @return True if the data is valid, otherwise false.
|
||||
*/
|
||||
bool ReadPacketNew(int apiId, CANData* data);
|
||||
|
||||
/**
|
||||
* Read a CAN packet. The will continuously return the last packet received,
|
||||
* without accounting for packet age.
|
||||
*
|
||||
* @param apiId The API ID to read.
|
||||
* @param data Storage for the received data.
|
||||
* @return True if the data is valid, otherwise false.
|
||||
*/
|
||||
bool ReadPacketLatest(int apiId, CANData* data);
|
||||
|
||||
/**
|
||||
* Read a CAN packet. The will return the last packet received until the
|
||||
* packet is older then the requested timeout. Then it will return false.
|
||||
*
|
||||
* @param apiId The API ID to read.
|
||||
* @param timeoutMs The timeout time for the packet
|
||||
* @param data Storage for the received data.
|
||||
* @return True if the data is valid, otherwise false.
|
||||
*/
|
||||
bool ReadPacketTimeout(int apiId, int timeoutMs, CANData* data);
|
||||
|
||||
/**
|
||||
* Read a CAN packet. The will return the last packet received until the
|
||||
* packet is older then the requested timeout. Then it will return false. The
|
||||
* period parameter is used when you know the packet is sent at specific
|
||||
* intervals, so calls will not attempt to read a new packet from the network
|
||||
* until that period has passed. We do not recommend users use this API unless
|
||||
* they know the implications.
|
||||
*
|
||||
* @param apiId The API ID to read.
|
||||
* @param timeoutMs The timeout time for the packet
|
||||
* @param periodMs The usual period for the packet
|
||||
* @param data Storage for the received data.
|
||||
* @return True if the data is valid, otherwise false.
|
||||
*/
|
||||
bool ReadPeriodicPacket(int apiId, int timeoutMs, int periodMs,
|
||||
CANData* data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user