mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Add CAN API constructor that takes explicit manufacturer and device type (#1311)
Useful for vendors wanting to use the API and make their own device parameters
This commit is contained in:
committed by
Peter Johnson
parent
a846ed062f
commit
59386635e7
@@ -32,13 +32,30 @@ public class CAN implements Closeable {
|
||||
|
||||
/**
|
||||
* Create a new CAN communication interface with the specific device ID.
|
||||
* The device ID is 6 bits (0-63)
|
||||
* This uses the team manufacturer and device types.
|
||||
* The device ID is 6 bits (0-63).
|
||||
*
|
||||
* @param deviceId The device id
|
||||
*/
|
||||
public CAN(int deviceId) {
|
||||
m_handle = CANAPIJNI.initializeCAN(kTeamManufacturer, deviceId, kTeamDeviceType);
|
||||
HAL.report(tResourceType.kResourceType_CAN, deviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new CAN communication interface with a specific device ID,
|
||||
* manufacturer and device type. The device ID is 6 bits, the
|
||||
* manufacturer is 8 bits, and the device type is 5 bits.
|
||||
*
|
||||
* @param deviceId The device ID
|
||||
* @param deviceManufacturer The device manufacturer
|
||||
* @param deviceType The device type
|
||||
*/
|
||||
public CAN(int deviceId, int deviceManufacturer, int deviceType) {
|
||||
m_handle = CANAPIJNI.initializeCAN(deviceManufacturer, deviceId, deviceType);
|
||||
HAL.report(tResourceType.kResourceType_CAN, deviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the CAN communication.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user