libpropeller
Making PropellerGCC Easier
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | List of all members
Elum Class Reference

Elum class to allow access to single Elums. More...

#include <elum.h>

Public Types

enum  elumColor { RED, GREEN }
 Use these constants to set the displayed LED color: Max8819::RED Max8819::GREEN. More...
 
enum  patternType {
  kSingleSlow, kSingle, kSingleSyncopated, kDouble,
  kTriple, kManyFast, kJitterFast
}
 

Public Member Functions

 Elum (int RedPin, int GreenPin, int ButtonPin)
 Initialize the Elum class. More...
 
 Elum ()
 
void Start (int RedPin, int GreenPin, int ButtonPin)
 
 ~Elum ()
 
bool GetButton ()
 
void Slowclock (void)
 
void On (elumColor whichColor)
 
void Off (void)
 
void Flash (int color, int period_ms, int flash_ms)
 Set the LED color to flash. More...
 
void Pattern (patternType pattern)
 Alternate in the following pattern: More...
 
void Fade (int frequency)
 Fades both LEDs in and out. More...
 

Detailed Description

Elum class to allow access to single Elums.

Warning
This should not be used for a "heartbeat" or watchdog type application, since the LED will remain lit even if the program crashes or does some other unexpected action.
Not cog-safe: do not attempt to use from multiple cogs, even if they don't use it simultaneously (it uses cog counters for flashing, so it won't work on a different cog).
This object may use the cog counters. (SRLM): In which situations?

(SRLM): What are the hardware requirements?

Some parts based on Pins.h by David Michael Betz. Some parts based on an example by Tracey Allen.

Member Enumeration Documentation

Use these constants to set the displayed LED color: Max8819::RED Max8819::GREEN.

Enumerator
RED 
GREEN 
Enumerator
kSingleSlow 
kSingle 
kSingleSyncopated 
kDouble 
kTriple 
kManyFast 
kJitterFast 

Constructor & Destructor Documentation

Elum::Elum ( int  RedPin,
int  GreenPin,
int  ButtonPin 
)
inline

Initialize the Elum class.

Parameters
RedPinthe pin that the RED led is sunk to
GreenPinthe pin that the GREEN led is sunk to
ButtonPin,:the pin to make input to read the button. The button should have a pullup, so that it is NC=1, and active low.

Here is the call graph for this function:

Elum::Elum ( )
inline
Elum::~Elum ( )
inline

Here is the call graph for this function:

Member Function Documentation

void Elum::Fade ( int  frequency)
inline

Fades both LEDs in and out.

Parameters
frequencyThe rate at which to flash the combined LEDs, in units of 0.1Hz/LSb

Here is the call graph for this function:

void Elum::Flash ( int  color,
int  period_ms,
int  flash_ms 
)
inline

Set the LED color to flash.

For example:

elum.Flash(Elum::GREEN, 1000, 750); //Set Green to turn on for 750ms, and off for 250ms
Parameters
colorElum::RED or Elum::GREEN
period_msThe frequency that the color is flashed
flash_msThe duration of the displayed color. Must be less than period_ms
bool Elum::GetButton ( )
inline
Returns
true if button is pressed, false if it is not.
void Elum::Off ( void  )
inline
void Elum::On ( elumColor  whichColor)
inline
void Elum::Pattern ( patternType  pattern)
inline

Alternate in the following pattern:

Single Slow: 5, 10, 0 (RG RG RG RG ...) ~13 seconds / cycle Single Slow Reverse: 5, 10, 50 (GR GR GR GR ...) ~13 seconds / cycle Single: 20, 60, 0 (G R G R G R ...) Single Syncopated: 20, 60, 50 (RG GR RG GR ...) Double: 20, 100, 0 (R R G G R R ...) Triple: 10, 50, 50 (G G GR R RG ...) Many Fast: 20, 400, 0 (G ... R ... ) Fast flickers, repeat each color ~ 10 times ~3 seconds / cycle Jitter Fast: 200, 300, 0 (GGRR GGRR ...) Really fast

Here is the call graph for this function:

void Elum::Slowclock ( void  )
inline
void Elum::Start ( int  RedPin,
int  GreenPin,
int  ButtonPin 
)
inline

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