Source code for the Curilights Controller. See http://www.saccade.com/writing/projects/CuriController/ for details.

Dependencies:   FatFileSystem mbed

This is the source code for the Curilights controller. This lets you interactively control a string of Curilights. It provides a simple click-wheel user interface for changing colors, brightness and behavior. It responds to movement and lighting.

Finished Controller

/media/uploads/isonno/nxp3872_controllerclose.jpg

System Block Diagram

/media/uploads/isonno/blockdiagram.png

SystemState.h

Committer:
isonno
Date:
2012-01-17
Revision:
3:0ac64c4ca40f
Parent:
0:6da5625a6946

File content as of revision 3:0ac64c4ca40f:

#ifndef _SYSTEMSTATE_
#define _SYSTEMSTATE_

#ifndef _USERINTERFACE_
#include "UserInterface.h"
#endif

#ifndef MBED_H
#include "mbed.h"
#endif

#include <string>

#define DEFINE_GET_SET_VAR( vtype, name ) \
public:\
 vtype Get ## name() const { return f ## name; };\
 void Set ## name( const vtype& var ) { if (f ## name != var) { f ## name = var; Modified(); } };\
private:\
 vtype f ## name;


class SystemState 
{
public:
  SystemState();
  ~SystemState() {};
  bool LoadState();
  void DumpState();     // Debug
  
  DEFINE_GET_SET_VAR( ESelector, ModeSelector )
  DEFINE_GET_SET_VAR( int,       BrightLevel  )
  DEFINE_GET_SET_VAR( int,       SatColorIndex)
  DEFINE_GET_SET_VAR( int,       PatternIndex )
  DEFINE_GET_SET_VAR( int,       LightSensor  )
  
private:
  Timeout fStateTimer;
  void SaveState();
  void Modified();
};

extern SystemState& gSystemState;

#endif