CTRE_Phoenix 5.20.2
|
Classes | |
enum | LEDStripType |
enum | VBatOutputMode |
CTRE CANdle
Device for controlling LEDs from the CAN bus.
// Example usage of a CANdle
CANdle candle = new CANdle(0); // creates a new CANdle with ID 0
CANdleConfiguration config = new CANdleConfiguration();
config.stripType = LEDStripType.RGB; // set the strip type to RGB
config.brightnessScalar = 0.5; // dim the LEDs to half brightness
candle.configAllSettings(config);
candle.setLEDs(255, 255, 255); // set the CANdle LEDs to white
// create a rainbow animation:
// - max brightness
// - half speed
// - 64 LEDs
RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 64);
candle.animate(rainbowAnim);
ErrorCode error = candle.getLastError(); // gets the last error generated by the CANdle
CANdleFaults faults = new CANdleFaults();
ErrorCode faultsError = candle.getFaults(faults); // fills faults with the current CANdle faults; returns the last error generated
|
inline |
|
inline |
|
inline |
Clears the sticky faults.
|
inline |
Clears the sticky faults.
timeoutMs | 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. |
|
inline |
Configures all persistent settings.
allConfigs | Object with all of the persistant settings |
|
inline |
Configures all persistent settings.
allConfigs | Object with all of the persistant settings |
timeoutMs | 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. |
|
inline |
Configures the brightness scalar to be applied to every LED output. This value is bounded to [0, 1].
Setting this to 1 will allow the LEDs to function at max brightness. Setting this to 0.5 will scale all values to half their applied value. Setting this to 0 will turn off the LEDs.
Forcing the LEDs off this way may be useful in certain testing circumstances but is generally not necessary. Self-test (Tuner) may be used to verify what the effective scalar is in case user forgot to restore the scalar to a non-zero value.
brightness | Value from [0, 1] that will scale the LED output. |
|
inline |
Configures the brightness scalar to be applied to every LED output. This value is bounded to [0, 1].
Setting this to 1 will allow the LEDs to function at max brightness. Setting this to 0.5 will scale all values to half their applied value. Setting this to 0 will turn off the LEDs.
Forcing the LEDs off this way may be useful in certain testing circumstances but is generally not necessary. Self-test (Tuner) may be used to verify what the effective scalar is in case user forgot to restore the scalar to a non-zero value.
brightness | Value from [0, 1] that will scale the LED output. |
timeoutMs | 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. |
|
inline |
Configures all persistent settings to defaults.
|
inline |
Configures all persistent settings to defaults.
timeoutMs | 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. |
|
inline |
Gets 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.
paramIndex | Index of custom parameter. [0-1] |
|
inline |
Gets 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.
paramIndex | Index of custom parameter. [0-1] |
timeoutMs | 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. |
|
inline |
Gets a parameter. Generally this is not used. This can be utilized in
param | Parameter enumeration. |
ordinal | Ordinal of parameter. |
|
inline |
Gets a parameter. Generally this is not used. This can be utilized in
param | Parameter enumeration. |
ordinal | Ordinal of parameter. |
timeoutMs | 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. |
|
inline |
|
inline |
Configures the type of LED the CANdle controls
type | The type of the LEDs the CANdle controls |
timeoutMs | 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. |
|
inline |
|
inline |
Configures what the CANdle should do if it loses communications to the Controller
disableWhenLOS | Set to true to disable the LEDs on Loss of Signal. |
timeoutMs | 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. |
|
inline |
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.
paramIndex | Index of custom parameter. [0-1] |
value | Value for custom parameter. |
|
inline |
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.
paramIndex | Index of custom parameter. [0-1] |
value | Value for custom parameter. |
timeoutMs | 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. |
|
inline |
Sets a parameter. Generally this is not used. This can be utilized in
param | Parameter enumeration. |
value | Value of parameter. |
subValue | Subvalue for parameter. Maximum value of 255. |
ordinal | Ordinal of parameter. |
|
inline |
Sets a parameter. Generally this is not used. This can be utilized in
param | Parameter enumeration. |
value | Value of parameter. |
subValue | Subvalue for parameter. Maximum value of 255. |
ordinal | Ordinal of parameter. |
timeoutMs | 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. |
|
inline |
Configures how the status led will behave when the CANdle is actively controlling LEDs If the CANdle is LOS or not actively commanded a value, it will always turn on its status LED.
disableWhenRunning | Disables the status LED when the CANdle is running |
|
inline |
Configures how the status led will behave when the CANdle is actively controlling LEDs If the CANdle is LOS or not actively commanded a value, it will always turn on its status LED.
disableWhenRunning | Disables the status LED when the CANdle is running |
timeoutMs | 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. |
|
inline |
Configures how the VBat Output will behave
mode | VBat Output Behavior |
|
inline |
Configures how the VBat Output will behave
mode | VBat Output Behavior |
timeoutMs | 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. |
|
inline |
Gets the Voltage of the 5V line as measured by CANdle
|
inline |
Gets all persistant settings.
allConfigs | Object with all of the persistant settings |
|
inline |
Gets all persistant settings.
allConfigs | Object with all of the persistant settings |
timeoutMs | 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. |
|
inline |
Gets the Voltage of VBat as measured by CANdle
|
inline |
Gets the low-side current as measured by CANdle
|
inline |
Gets the CANdle fault status
toFill | Container for fault statuses. |
|
inline |
Call GetLastError() generated by this object. Not all functions return an error code but can potentially report errors.
This function can be used to retrieve those error codes.
|
inline |
Gets the period of the given status frame.
frame | Frame to get the period of. |
|
inline |
Gets the period of the given status frame.
frame | Frame to get the period of. |
timeoutMs | 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. |
|
inline |
Gets the CANdle sticky fault status
toFill | Container for sticky fault statuses. |
|
inline |
Gets the temperature of the CANdle in Celcius
|
inline |
|
inline |
Returns true if the device has reset since last call.
|
inline |
|
inline |
Sets the period of the given control frame.
frame | Frame whose period is to be changed. |
periodMs | Period in ms for the given frame. |
|
inline |
Sets a block of LEDs to the specified color. This will apply to the first 255 LEDs.
r | The amount of Red to set, range is [0, 255] |
g | The amount of Green to set, range is [0, 255] |
b | The amount of Blue to set, range is [0, 255] |
|
inline |
Sets a block of LEDs to the specified color
r | The amount of Red to set, range is [0, 255] |
g | The amount of Green to set, range is [0, 255] |
b | The amount of Blue to set, range is [0, 255] |
w | The amount of White to set, range is [0, 255]. This only applies for LED strips with white in them. |
startIdx | Where to start setting the LEDs |
count | The number of LEDs to apply this to |
|
inline |
Sets the period of the given status frame.
frame | Frame whose period is to be changed. |
periodMs | Period in ms for the given frame. |
|
inline |
Sets the period of the given status frame.
frame | Frame whose period is to be changed. |
periodMs | Period in ms for the given frame. |
timeoutMs | 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. |