2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
argos_lib::LEDSubsystem Class Reference

#include <led_subsystem.h>

Inheritance diagram for argos_lib::LEDSubsystem:

Classes

struct  LEDUpdateGroup
 Represents a contiguous block of LEDs that have the same color. More...
 

Public Member Functions

 LEDSubsystem (unsigned numAuxLEDs)
 Construct a new LEDSubsystem object.
 
void Periodic () override
 
void StockAnimateAuxLEDs (ctre::phoenix::led::Animation &animation, int slot)
 Set LEDs in attached strip/panel to use stock animation.
 
void StockAnimateIntegratedLEDs (ctre::phoenix::led::Animation &animation, int slot)
 Set LEDs built into CANdle to use stock animation.
 
void CustomAnimateAuxLEDs (argos_lib::led::Animation animation)
 Set LEDs in attached strip/panel to use custom animation. The LEDs will be updated on every call of the subsystem periodic function.
 
void CustomAnimateIntegratedLEDs (argos_lib::led::Animation animation)
 Set LEDs built into CANdle to use custom animation. The LEDs will be updated on every call of the subsystem periodic function.
 

Private Member Functions

std::vector< LEDUpdateGroupGetDeltaUpdate (const std::vector< LEDState > &prev, const std::vector< LEDState > &current)
 Get sendable LED block updates to change from prev to current.
 

Private Attributes

std::vector< LEDStatem_currentLEDs
 LED status to send as update.
 
std::vector< LEDStatem_prevLEDs
 LED status prior to last update.
 
std::vector< argos_lib::led::Animationm_customAnimations
 Active animations.
 
ctre::phoenix::led::CANdle m_controller
 LED controller instance with attached LEDs.
 

Static Private Attributes

static constexpr unsigned numIntegratedLEDs = 8
 Number of LEDs addressed before attached LED strip/panel.
 

Constructor & Destructor Documentation

◆ LEDSubsystem()

LEDSubsystem::LEDSubsystem ( unsigned  numAuxLEDs)
explicit

Construct a new LEDSubsystem object.

Parameters
numAuxLEDsNumber of LEDs attached to the CANdle

Member Function Documentation

◆ CustomAnimateAuxLEDs()

void LEDSubsystem::CustomAnimateAuxLEDs ( argos_lib::led::Animation  animation)

Set LEDs in attached strip/panel to use custom animation. The LEDs will be updated on every call of the subsystem periodic function.

Parameters
animationAnimation to use where led offset 0 is beginning of attached LEDs

◆ CustomAnimateIntegratedLEDs()

void LEDSubsystem::CustomAnimateIntegratedLEDs ( argos_lib::led::Animation  animation)

Set LEDs built into CANdle to use custom animation. The LEDs will be updated on every call of the subsystem periodic function.

Parameters
animationAnimation to use

◆ GetDeltaUpdate()

std::vector< LEDSubsystem::LEDUpdateGroup > LEDSubsystem::GetDeltaUpdate ( const std::vector< LEDState > &  prev,
const std::vector< LEDState > &  current 
)
private

Get sendable LED block updates to change from prev to current.

Parameters
prevOld LED state
currentNew LED state
Returns
std::vector<LEDUpdateGroup> Minimal set of updates to change from prev to current

◆ Periodic()

void LEDSubsystem::Periodic ( )
override

Will be called periodically whenever the CommandScheduler runs.

◆ StockAnimateAuxLEDs()

void LEDSubsystem::StockAnimateAuxLEDs ( ctre::phoenix::led::Animation &  animation,
int  slot 
)

Set LEDs in attached strip/panel to use stock animation.

Parameters
animationAnimation to assign where led offset 0 is beginning of attached LEDs
slotAnimation slot to use

◆ StockAnimateIntegratedLEDs()

void LEDSubsystem::StockAnimateIntegratedLEDs ( ctre::phoenix::led::Animation &  animation,
int  slot 
)

Set LEDs built into CANdle to use stock animation.

Parameters
animationAnimation to assign
slotAnimation slot to use

Member Data Documentation

◆ m_controller

ctre::phoenix::led::CANdle argos_lib::LEDSubsystem::m_controller
private

LED controller instance with attached LEDs.

◆ m_currentLEDs

std::vector<LEDState> argos_lib::LEDSubsystem::m_currentLEDs
private

LED status to send as update.

◆ m_customAnimations

std::vector<argos_lib::led::Animation> argos_lib::LEDSubsystem::m_customAnimations
private

Active animations.

◆ m_prevLEDs

std::vector<LEDState> argos_lib::LEDSubsystem::m_prevLEDs
private

LED status prior to last update.

◆ numIntegratedLEDs

constexpr unsigned argos_lib::LEDSubsystem::numIntegratedLEDs = 8
staticconstexprprivate

Number of LEDs addressed before attached LED strip/panel.


The documentation for this class was generated from the following files: