Struct ctre::canifier::CANifier

source ·
pub struct CANifier { /* private fields */ }
Expand description

CTRE CANifier

Device for interfacing common devices to the CAN bus.

Implementations§

Constructor.

  • device_number - The CAN Device ID of the CANifier.

Sets the output of all General Pins

  • output_bits - A bit mask of all the output states. LSB->MSB is in the order of the GeneralPin enum.
  • is_output_bits - A boolean bit mask that sets the pins to be outputs or inputs. A bit of 1 enables output.

Sets the PWM Output Currently supports PWM 0, PWM 1, and PWM 2

  • pwm_channel - Index of the PWM channel to output.
  • duty_cycle - Duty Cycle (0 to 1) to output. Default period of the signal is 4.2 ms.

Enables PWM Outputs Currently supports PWM 0, PWM 1, and PWM 2

Gets the state of all General Pins

Gets the state of the specified pin

Gets the PWM Input. Returns a 2-array holding the Pulse Width (microseconds) [0] and Period (microseconds) [1].

Configures the period of each velocity sample. Every 1ms a position value is sampled, and the delta between that sample and the position sampled kPeriod ms ago is inserted into a filter. kPeriod is configured with this function.

Sets a parameter. Generally this is not used. This can be utilized in

  • Using new features without updating API installation.
  • Errata workarounds to circumvent API implementation.
  • Allows for rapid testing / unit testing of firmware.

Sets the value of a custom parameter. This is for arbitrary use.

Sometimes it is necessary to save calibration/duty cycle/output information in the device. Particularly if the device is part of a subsystem that can be replaced.

  • new_value - Value for custom parameter.
  • param_index - Index of custom parameter [0,1]
  • timeout_ms - Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.

Gets the value of a custom parameter. This is for arbitrary use.

  • param_index - Index of custom parameter [0,1].
  • timeout_ms - Timeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.