Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FatFileSystem mbed
SystemState.h@3:0ac64c4ca40f, 2012-01-17 (annotated)
- Committer:
- isonno
- Date:
- Tue Jan 17 13:45:17 2012 +0000
- Revision:
- 3:0ac64c4ca40f
- Parent:
- 0:6da5625a6946
LightSensor settings menu; more work (unsuccessful) on serial input from USB.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
isonno |
0:6da5625a6946 | 1 | #ifndef _SYSTEMSTATE_ |
isonno |
0:6da5625a6946 | 2 | #define _SYSTEMSTATE_ |
isonno |
0:6da5625a6946 | 3 | |
isonno |
0:6da5625a6946 | 4 | #ifndef _USERINTERFACE_ |
isonno |
0:6da5625a6946 | 5 | #include "UserInterface.h" |
isonno |
0:6da5625a6946 | 6 | #endif |
isonno |
0:6da5625a6946 | 7 | |
isonno |
0:6da5625a6946 | 8 | #ifndef MBED_H |
isonno |
0:6da5625a6946 | 9 | #include "mbed.h" |
isonno |
0:6da5625a6946 | 10 | #endif |
isonno |
0:6da5625a6946 | 11 | |
isonno |
0:6da5625a6946 | 12 | #include <string> |
isonno |
0:6da5625a6946 | 13 | |
isonno |
0:6da5625a6946 | 14 | #define DEFINE_GET_SET_VAR( vtype, name ) \ |
isonno |
0:6da5625a6946 | 15 | public:\ |
isonno |
0:6da5625a6946 | 16 | vtype Get ## name() const { return f ## name; };\ |
isonno |
0:6da5625a6946 | 17 | void Set ## name( const vtype& var ) { if (f ## name != var) { f ## name = var; Modified(); } };\ |
isonno |
0:6da5625a6946 | 18 | private:\ |
isonno |
0:6da5625a6946 | 19 | vtype f ## name; |
isonno |
0:6da5625a6946 | 20 | |
isonno |
0:6da5625a6946 | 21 | |
isonno |
0:6da5625a6946 | 22 | class SystemState |
isonno |
0:6da5625a6946 | 23 | { |
isonno |
0:6da5625a6946 | 24 | public: |
isonno |
0:6da5625a6946 | 25 | SystemState(); |
isonno |
0:6da5625a6946 | 26 | ~SystemState() {}; |
isonno |
0:6da5625a6946 | 27 | bool LoadState(); |
isonno |
0:6da5625a6946 | 28 | void DumpState(); // Debug |
isonno |
0:6da5625a6946 | 29 | |
isonno |
0:6da5625a6946 | 30 | DEFINE_GET_SET_VAR( ESelector, ModeSelector ) |
isonno |
0:6da5625a6946 | 31 | DEFINE_GET_SET_VAR( int, BrightLevel ) |
isonno |
0:6da5625a6946 | 32 | DEFINE_GET_SET_VAR( int, SatColorIndex) |
isonno |
0:6da5625a6946 | 33 | DEFINE_GET_SET_VAR( int, PatternIndex ) |
isonno |
3:0ac64c4ca40f | 34 | DEFINE_GET_SET_VAR( int, LightSensor ) |
isonno |
0:6da5625a6946 | 35 | |
isonno |
0:6da5625a6946 | 36 | private: |
isonno |
0:6da5625a6946 | 37 | Timeout fStateTimer; |
isonno |
0:6da5625a6946 | 38 | void SaveState(); |
isonno |
0:6da5625a6946 | 39 | void Modified(); |
isonno |
0:6da5625a6946 | 40 | }; |
isonno |
0:6da5625a6946 | 41 | |
isonno |
0:6da5625a6946 | 42 | extern SystemState& gSystemState; |
isonno |
0:6da5625a6946 | 43 | |
isonno |
0:6da5625a6946 | 44 | #endif |