RSeries astromech firmware
NeoPixelPSI Class Reference

#include <dome/NeoPixelPSI.h>

Detailed Description

NeoPixelPSI by Darren Poulson daz@r.nosp@m.2djp.nosp@m..co.u.nosp@m.k

NeoPixelPSI are very simple and cheap boards, in reality just a string of neopixels on a disk. This class will configure them to act as standard PSIs for R2.

For more info:

https://r2djp.co.uk/category/electronics/neopixel-psi/

Example Code:

NeoPixelPSI rearPSI(4);
NeoPixelPSI frontPSI(3);
NeoPixelPSI by Darren Poulson daz@r2djp.co.uk
Definition: NeoPixelPSI.h:42
+ Inheritance diagram for NeoPixelPSI:
+ Collaboration diagram for NeoPixelPSI:

Public Types

enum  EffectValue { kNormalVal = 0 }
 
enum  Sequence { kNormal = 0 , kSolid = 1 , kHeart = 2 , kMalf = 3 }
 
enum  PSIID { kFrontPSI = 1 , kRearPSI = 2 }
 

Public Member Functions

virtual void setup () override
 Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor. More...
 
 NeoPixelPSI (int psi_pin, int psi_size=5)
 Constructor. More...
 
void selectEffect (long inputNum)
 Select the specified effect using a 32-bit integer. More...
 
virtual void handleCommand (const char *cmd) override
 Command Prefix: PS. More...
 
void setSequence (Sequence seq=kNormal, uint8_t speedScale=0, uint8_t numSeconds=0)
 Select the specified effect sequence. More...
 
virtual void animate ()
 Subclasses must implement this function to run through a single frame of animation/activity. More...
 
void set_brightness (int bright)
 Set the brightness of the PSI. More...
 
virtual void set_color (int c, int r, int g, int b)
 set the colors of the PSI More...
 
void set_speed (int s)
 Set the speed the swipe effect moves at. More...
 
void set_delay (int d)
 Set the delay between swipes. More...
 
void set_stickiness (int s)
 Set the 'stickiness'. More...
 
- Public Member Functions inherited from AnimatedEvent
 AnimatedEvent ()
 Default Constructor. More...
 
void setLoopDoneCallback (AnimatedLoopDone loopProc)
 

Public Attributes

Adafruit_NeoPixel leds
 

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 

◆ PSIID

Enumerator
kFrontPSI 

Front PSI ID.

kRearPSI 

Rear PSI ID.

◆ Sequence

Enumerator
kNormal 
kSolid 
kHeart 
kMalf 

Constructor & Destructor Documentation

◆ NeoPixelPSI()

NeoPixelPSI::NeoPixelPSI ( int  psi_pin,
int  psi_size = 5 
)
inline

Constructor.

Pass the pin number for the PSI and optionally the size of the PSI (for denser pixel counts)

Member Function Documentation

◆ animate()

virtual void NeoPixelPSI::animate ( )
inlinevirtual

Subclasses must implement this function to run through a single frame of animation/activity.

Subclasses should not call delay() or otherwise block.

Implements AnimatedEvent.

◆ handleCommand()

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

Command Prefix: PS.

Implements CommandEvent.

◆ selectEffect()

void NeoPixelPSI::selectEffect ( long  inputNum)
inline

Select the specified effect using a 32-bit integer.

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

◆ set_brightness()

void NeoPixelPSI::set_brightness ( int  bright)
inline

Set the brightness of the PSI.

Send a value from 0-255 to set the brightness, the higher the number the brighter it is

Don't set 255 straight away, these can be bright. Typical value is between 20-50

◆ set_color()

virtual void NeoPixelPSI::set_color ( int  c,
int  r,
int  g,
int  b 
)
inlinevirtual

set the colors of the PSI

  • color number (1=first, 2=second)
  • red
  • green
  • blue

◆ set_delay()

void NeoPixelPSI::set_delay ( int  d)
inline

Set the delay between swipes.

Set how many ms between swipes. The actual value will be between

and

*4

◆ set_speed()

void NeoPixelPSI::set_speed ( int  s)
inline

Set the speed the swipe effect moves at.

Lower the number, the faster the swipe. This is in ms Typical value is around 75

◆ set_stickiness()

void NeoPixelPSI::set_stickiness ( int  s)
inline

Set the 'stickiness'.

To simulate the original PSI 'sticking' halfway through a swipe, you can set the percentage chance of the swipe halting for a period (as set in set_delay()).

Default: 0 Range: 0-100

◆ setSequence()

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

Select the specified effect sequence.

◆ setup()

virtual void NeoPixelPSI::setup ( )
inlineoverridevirtual

Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor.

Implements SetupEvent.

Member Data Documentation

◆ leds

Adafruit_NeoPixel NeoPixelPSI::leds

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