Class CanBus

java.lang.Object
com.studica.frc.CanBus

public final class CanBus extends Object
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.

  • Method Details

    • requestMode

      public static Status requestMode(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).

      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-S4
      mode - the mode to switch to
      Returns:
      the result
    • getMode

      public static Optional<CanBus.Mode> getMode(org.wpilib.hardware.bus.CANPort port)
      Gets a bus's current mode.
      Parameters:
      port - CAN port S0-S4
      Returns:
      the mode, or empty if not reported yet or non-standard