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
System Block Diagram
Diff: SystemState.h
- Revision:
- 0:6da5625a6946
- Child:
- 3:0ac64c4ca40f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SystemState.h Thu Dec 29 01:59:53 2011 +0000 @@ -0,0 +1,43 @@ +#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 ) + +private: + Timeout fStateTimer; + void SaveState(); + void Modified(); +}; + +extern SystemState& gSystemState; + +#endif