Skip to content

Commit

Permalink
Added class documentation per spydergt1's request in issue 6.
Browse files Browse the repository at this point in the history
  • Loading branch information
sowbug committed Jan 4, 2012
1 parent c8294a0 commit d7cded5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions G35.h
Expand Up @@ -32,8 +32,8 @@
#define COLOR_INDIGO COLOR(0x6, 0, 0xf)
#define COLOR_VIOLET COLOR(0x8, 0, 0xf)

// A virtual class representing a string of G35 lights of arbitrary length.
// LightPrograms talk to this interface.
// G35 is an abstract class representing a string of G35 lights of arbitrary
// length. LightPrograms talk to this interface.
class G35 {
public:
G35();
Expand Down
10 changes: 10 additions & 0 deletions G35String.h
Expand Up @@ -12,6 +12,16 @@

#include <G35.h>

// A G35String knows how to talk to a real GE Color Effects light string.
// In particular, it implements the set_color() method of the G35 interface.
//
// These strings need enumerate() to be called before anything else, so that
// each bulb has an individual address. In many cases, your lights will work
// as expected even if you forget to call enumerate(), because most programs
// happen to do the same thing as enumerate() -- namely, they send commands
// to all bulbs starting with bulb #0 and ending with bulb #N-1. If your
// light programs look right but fractured, it's because you forgot to call
// enumerate().
class G35String : public G35 {
public:
// |pin|: the Arduino pin driving this string's data line.
Expand Down
6 changes: 6 additions & 0 deletions G35StringGroup.h
Expand Up @@ -12,6 +12,12 @@

#include <G35.h>

// A G35StringGroup takes a set of G35 instances and presents them as a single
// virtual light string of arbitrary length.
//
// A LightProgram that is given a G35StringGroup will then be able to run
// itself over the whole virtual string, without needing to know the details
// of which physical string contains which logical bulb.
class G35StringGroup : public G35 {
public:
G35StringGroup();
Expand Down
3 changes: 3 additions & 0 deletions LightProgram.h
Expand Up @@ -14,6 +14,9 @@
#include <G35.h>

// Interface for light programs.
//
// A "light program" is what GE means when they say their lights include 14
// programs. An example is "Chasing Red, White, and Blue."
class LightProgram {
public:
LightProgram(G35& g35)
Expand Down
10 changes: 10 additions & 0 deletions ProgramRunner.h
Expand Up @@ -13,6 +13,16 @@

#include <LightProgram.h>

// ProgramRunner manages a collection of LightPrograms.
//
// It gives the current program a slice of time to run, decides when it's
// time to switch to the next program, and asks the program_creator callback
// to give it the next program when it's time. In Arduino terms, it's what
// you want to call in your loop() method.
//
// switch_program() is public because the application might sometimes want
// to change programs more frequently, for example if you've implemented
// a remote control receiver.
class ProgramRunner {
public:
ProgramRunner(LightProgram* (*program_creator)(uint8_t program_index),
Expand Down

0 comments on commit d7cded5

Please sign in to comment.