RSeries astromech firmware
ChargeBayIndicator Class Reference

#include <body/ChargeBayIndicator.h>

Detailed Description

ChargeBayIndicator (CBI) controller.

ChargeBayIndicator (CBI) consists of a single MAX7221 device operating a 5x4 grid of LEDs plus 3 individual VCC indicator LEDs.

The 5x4 grid is arranged as follows. Only the top 5 bits of each byte are significant.
Column# 0 1 2 3 4
Bit 8 7 6 5 4
----------
O O O O O | row #0
O O O O O | row #1
O O O O O | row #2
O O O O O | row #3
Red LED row #4 col #5 Bit pattern B00000100 (B10000000>>5)
Yellow LED row #5 col #5 Bit pattern B00000100 (B10000000>>5)
Green LED row #6 col #5 Bit pattern B00000100 (B10000000>>5)
+ Inheritance diagram for ChargeBayIndicator:
+ Collaboration diagram for ChargeBayIndicator:

Public Types

enum  EffectValue { kNormalVal = 0 }
 
enum  Sequence {
  kNormal = 0, kDisabled = 1, kFlicker = 2, kNaboo = 3,
  kCharging = 4, kBlink = 5, kHeart = 6, kVCCOnly = 7
}
 

Public Member Functions

 ChargeBayIndicator (LedControl &ledControl, int analogInput=-1)
 Constructor. More...
 
void selectEffect (long inputNum)
 Select the specified effect using a 32-bit integer. More...
 
void setSequence (Sequence seq=kNormal, uint8_t speedScale=0, uint8_t numSeconds=0)
 Select the specified effect sequence. More...
 
virtual void setup () override
 Perform any initialzation not possible in the constructor. More...
 
virtual void animate () override
 Perform a single frame of LED animation based on the selected sequence. More...
 
virtual void handleCommand (const char *cmd) override
 ChargeBayIndicator Commands start with 'CB'. More...
 
void setRow (byte row, byte data)
 This function is only for the grid pattern not the VCC LEDs. More...
 
void setGreenLight (bool on)
 Turn the green LED on or off. More...
 
void setYellowLight (bool on)
 Turn the yellow LED on or off. More...
 
void setRedLight (bool on)
 Turn the red LED on or off. More...
 
void displayVCC ()
 Set the green/yellow/red LEDs based on the voltage levels read from the voltage divider. More...
 
void randomSEQ ()
 Update LEDs randomly for one frame. More...
 
void blinkSEQ ()
 Test utility routine for blinking all LEDs every two seconds. More...
 
void heartSEQ ()
 Pulse. More...
 
void chargingSEQ ()
 Animate the LEDs like ESB charging sequence. More...
 
void operatingSEQ ()
 Operating sequence. More...
 
void setVCCAnalogInputPin (int analogInput)
 Specify the analog pint used by the voltage divider. More...
 
float getVCC ()
 Read the voltage level from the voltage divider. More...
 
- Public Member Functions inherited from AnimatedEvent
 AnimatedEvent ()
 Default Constructor. More...
 
void setLoopDoneCallback (AnimatedLoopDone loopProc)
 

Additional Inherited Members

- Static Public Member Functions inherited from AnimatedEvent
static void process ()
 Calls animate() for each created AnimatedEvent subclass. More...
 

Member Enumeration Documentation

◆ EffectValue

Enumerator
kNormalVal 

◆ Sequence

Enumerator
kNormal 
kDisabled 
kFlicker 
kNaboo 
kCharging 
kBlink 
kHeart 
kVCCOnly 

Constructor & Destructor Documentation

◆ ChargeBayIndicator()

ChargeBayIndicator::ChargeBayIndicator ( LedControl &  ledControl,
int  analogInput = -1 
)
inline

Constructor.

"analogInput" defaults to disabled

Member Function Documentation

◆ animate()

virtual void ChargeBayIndicator::animate ( )
inlineoverridevirtual

Perform a single frame of LED animation based on the selected sequence.

Implements AnimatedEvent.

◆ blinkSEQ()

void ChargeBayIndicator::blinkSEQ ( )
inline

Test utility routine for blinking all LEDs every two seconds.

◆ chargingSEQ()

void ChargeBayIndicator::chargingSEQ ( )
inline

Animate the LEDs like ESB charging sequence.

◆ displayVCC()

void ChargeBayIndicator::displayVCC ( )
inline

Set the green/yellow/red LEDs based on the voltage levels read from the voltage divider.

◆ getVCC()

float ChargeBayIndicator::getVCC ( )
inline

Read the voltage level from the voltage divider.

◆ handleCommand()

virtual void ChargeBayIndicator::handleCommand ( const char *  cmd)
inlineoverridevirtual

ChargeBayIndicator Commands start with 'CB'.

Implements CommandEvent.

◆ heartSEQ()

void ChargeBayIndicator::heartSEQ ( )
inline

Pulse.

◆ operatingSEQ()

void ChargeBayIndicator::operatingSEQ ( )
inline

Operating sequence.

◆ randomSEQ()

void ChargeBayIndicator::randomSEQ ( )
inline

Update LEDs randomly for one frame.

◆ selectEffect()

void ChargeBayIndicator::selectEffect ( long  inputNum)
inline

Select the specified effect using a 32-bit integer.

  • Sequence (0-99) * 10000
  • Speed (0-9) * 100
  • Duration (0-99)

◆ setGreenLight()

void ChargeBayIndicator::setGreenLight ( bool  on)
inline

Turn the green LED on or off.

◆ setRedLight()

void ChargeBayIndicator::setRedLight ( bool  on)
inline

Turn the red LED on or off.

◆ setRow()

void ChargeBayIndicator::setRow ( byte  row,
byte  data 
)
inline

This function is only for the grid pattern not the VCC LEDs.

Only the top 5 bits of each byte are significant. Shift up 3 to allow our B-style source code constants to reflect what we see displayed.

◆ setSequence()

void ChargeBayIndicator::setSequence ( Sequence  seq = kNormal,
uint8_t  speedScale = 0,
uint8_t  numSeconds = 0 
)
inline

Select the specified effect sequence.

◆ setup()

virtual void ChargeBayIndicator::setup ( )
inlineoverridevirtual

Perform any initialzation not possible in the constructor.

Implements SetupEvent.

◆ setVCCAnalogInputPin()

void ChargeBayIndicator::setVCCAnalogInputPin ( int  analogInput)
inline

Specify the analog pint used by the voltage divider.

◆ setYellowLight()

void ChargeBayIndicator::setYellowLight ( bool  on)
inline

Turn the yellow LED on or off.


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