/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/propeller-clock.cc

  • Committer: Tim Marston
  • Date: 2012-03-12 21:11:20 UTC
  • Revision ID: tim@ed.am-20120312211120-r86cs574yxztgqij
added time set mode, made text renderer's buffer auto reset/output

Show diffs side-by-side

added added

removed removed

79
79
#include "button.h"
80
80
#include "time.h"
81
81
#include "Arduino.h"
82
 
#include "modes/analogue_clock.h"
83
 
#include "modes/digital_clock.h"
84
 
#include "modes/test_pattern.h"
85
 
#include "modes/settings_mode.h"
 
82
#include "analogue_clock.h"
 
83
#include "digital_clock.h"
 
84
#include "test_pattern.h"
 
85
#include "settings_mode.h"
86
86
#include "text.h"
87
87
#include "text_renderer.h"
88
88
#include "common.h"
126
126
// activate the current minor mode
127
127
void activate_minor_mode()
128
128
{
129
 
        // reset text
130
 
        Text::reset();
131
 
        leds_off();
132
 
 
133
 
        // give the mode a chance to init
134
129
        switch( _minor_mode ) {
135
130
        case ANALOGUE_CLOCK_IDX: analogue_clock_activate(); break;
136
131
        case DIGITAL_CLOCK_IDX: digital_clock_activate(); break;
137
132
        }
 
133
 
 
134
        // reset text
 
135
        Text::reset();
 
136
        leds_off();
138
137
}
139
138
 
140
139
 
141
140
// activate major mode
142
141
void activate_major_mode()
143
142
{
144
 
        // reset text
145
 
        Text::reset();
146
 
        leds_off();
147
 
 
148
 
        // reset buttons
149
 
        _button.set_press_mode( _major_mode != SETTINGS_MODE_IDX );
150
 
 
151
 
        // give the mode a chance to init
152
143
        switch( _major_mode ) {
153
144
        case MAIN_MODE_IDX: activate_minor_mode(); break;
154
145
        case SETTINGS_MODE_IDX: settings_mode_activate(); break;
155
146
        }
 
147
 
 
148
        // reset text
 
149
        Text::reset();
 
150
        leds_off();
156
151
}
157
152
 
158
153
 
335
330
        // initialise RTC
336
331
        Time::init();
337
332
 
338
 
        // init text renderer
339
 
        TextRenderer::init();
340
 
 
341
333
        // activate the minor mode
342
334
        activate_major_mode();
343
335
}