/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/mode_switcher.cc

  • Committer: Tim Marston
  • Date: 2012-05-17 22:49:11 UTC
  • Revision ID: tim@ed.am-20120517224911-dbd9dtcpl14xlhi0
rewrote/fixed button event triggering code

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "mode_switcher.h"
2
 
#include "test_mode.h"
3
 
 
4
 
 
5
 
ModeSwitcher::ModeSwitcher()
6
 
{
7
 
        static TestMode test_mode;
8
 
 
9
 
        _modes.push_back( &test_mode );
10
 
}
11
 
 
12
 
 
13
 
void ModeSwitcher::short_press()
14
 
{
15
 
        _modes[ _mode ]->next_flavour();
16
 
}
17
 
 
18
 
 
19
 
void ModeSwitcher::long_press()
20
 
{
21
 
        if( ++_mode >= (signed)_modes.size() )
22
 
                _mode = 0;
23
 
        _modes[ _mode ]->activate();
24
 
}
25
 
 
26
 
 
27
 
void ModeSwitcher::activate()
28
 
{
29
 
        _mode = 0;
30
 
        _modes[ _mode ]->activate();
31
 
}
32
 
 
33
 
 
34
 
Drawer &ModeSwitcher::get_drawer()
35
 
{
36
 
        return *_modes[ _mode ];
37
 
}