Class CanBus
java.lang.Object
com.studica.frc.CanBus
SystemCore CAN bus configuration (ports S0-S4).
Studica CAN devices send CAN FD frames automatically whenever their bus is in an FD mode, so switching a bus is all that's needed to use FD.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<CanBus.Mode> getMode(org.wpilib.hardware.bus.CANPort port) Gets a bus's current mode.static StatusrequestMode(org.wpilib.hardware.bus.CANPort port, CanBus.Mode mode) Switches a bus to a mode, blocking until it is back up in that mode (up to 3 seconds).
-
Method Details
-
requestMode
Switches a bus to a mode, blocking until it is back up in that mode (up to 3 seconds).This affects every device on the bus, from every vendor, and the bus drops briefly while it switches. Call it once at startup, before creating devices. Every device on an FD bus must support CAN FD.
- Parameters:
port- CAN port S0-S4mode- the mode to switch to- Returns:
- the result
-
getMode
Gets a bus's current mode.- Parameters:
port- CAN port S0-S4- Returns:
- the mode, or empty if not reported yet or non-standard
-