/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-04-29 15:27:19 UTC
  • Revision ID: tim@ed.am-20120429152719-4cu2t9lx7bxpbml1
added adjustable text scaling factor

Show diffs side-by-side

added added

removed removed

Lines of Context:
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"
86
 
#include "modes/info_mode.h"
 
82
#include "analogue_clock.h"
 
83
#include "digital_clock.h"
 
84
#include "test_pattern.h"
 
85
#include "settings_mode.h"
87
86
#include "text.h"
88
87
#include "text_renderer.h"
89
88
#include "common.h"
119
118
#define ANALOGUE_CLOCK_IDX 0
120
119
#define DIGITAL_CLOCK_IDX 1
121
120
#define TEST_PATTERN_IDX 2
122
 
#define INFO_MODE_IDX 3
123
121
 
124
122
//_____________________________________________________________________________
125
123
//                                                                         code
136
134
        switch( _minor_mode ) {
137
135
        case ANALOGUE_CLOCK_IDX: analogue_clock_activate(); break;
138
136
        case DIGITAL_CLOCK_IDX: digital_clock_activate(); break;
139
 
        case INFO_MODE_IDX: info_mode_activate(); break;
140
137
        }
141
138
}
142
139
 
174
171
                                switch( _minor_mode ) {
175
172
                                case ANALOGUE_CLOCK_IDX: analogue_clock_press(); break;
176
173
                                case DIGITAL_CLOCK_IDX: digital_clock_press(); break;
177
 
                                case INFO_MODE_IDX: info_mode_press(); break;
178
174
                                }
179
175
                                break;
180
176
                        case SETTINGS_MODE_IDX: settings_mode_press(); break;
226
222
                        switch( _minor_mode ) {
227
223
                        case ANALOGUE_CLOCK_IDX: analogue_clock_draw_reset(); break;
228
224
                        case DIGITAL_CLOCK_IDX: digital_clock_draw_reset(); break;
229
 
                        case INFO_MODE_IDX: info_mode_draw_reset(); break;
230
225
                        }
231
226
                        break;
232
227
                case SETTINGS_MODE_IDX: settings_mode_draw_reset(); break;
243
238
                case ANALOGUE_CLOCK_IDX: analogue_clock_draw( segment ); break;
244
239
                case DIGITAL_CLOCK_IDX: digital_clock_draw( segment ); break;
245
240
                case TEST_PATTERN_IDX: test_pattern_draw( segment ); break;
246
 
                case INFO_MODE_IDX: info_mode_draw( segment ); break;
247
241
                }
248
242
                break;
249
243
        case SETTINGS_MODE_IDX: settings_mode_draw( segment ); break;
304
298
}
305
299
 
306
300
 
307
 
// ISR to handle the pulses from the fan's tachometer
 
301
// ISR to handle the pulses from the fan's tachiometer
308
302
void fan_pulse_handler()
309
303
{
310
304
        // the fan actually sends two pulses per revolution. These pulses
324
318
// main setup
325
319
void setup()
326
320
{
327
 
        // set up an interrupt handler on pin 2 to notice fan pulses
 
321
        // set up an interrupt handler on pin 2 to nitice fan pulses
328
322
        attachInterrupt( 0, fan_pulse_handler, RISING );
329
323
        digitalWrite( 2, HIGH );
330
324