Subversion Repositories Projects

Rev

Rev 902 | Rev 1197 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
471 cascade 1
/****************************************************************************
902 - 2
 *   Copyright (C) 2009-2011 by Claas Anders "CaScAdE" Rathje               *
471 cascade 3
 *   admiralcascade@gmail.com                                               *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
5
 *                                                                          *
6
 *   This program is free software; you can redistribute it and/or modify   *
7
 *   it under the terms of the GNU General Public License as published by   *
8
 *   the Free Software Foundation; either version 2 of the License.         *
9
 *                                                                          *
10
 *   This program is distributed in the hope that it will be useful,        *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
13
 *   GNU General Public License for more details.                           *
14
 *                                                                          *
15
 *   You should have received a copy of the GNU General Public License      *
16
 *   along with this program; if not, write to the                          *
17
 *   Free Software Foundation, Inc.,                                        *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
19
 ****************************************************************************/
20
 
800 - 21
#include "main.h"
471 cascade 22
#include <avr/io.h>
23
#include <avr/eeprom.h>
24
#include <avr/pgmspace.h>
25
#include <avr/interrupt.h>
26
#include <util/delay.h>
27
#include "max7456_software_spi.h"
28
#include "config.h"
29
#include "buttons.h"
30
#include "usart1.h"
837 - 31
#include "osd_helpers.h"
471 cascade 32
 
762 - 33
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
34
 
471 cascade 35
uint8_t EEMEM ee_checkbyte1 = CHECKBYTE1;
36
uint8_t EEMEM ee_checkbyte2 = CHECKBYTE2;
523 cascade 37
uint8_t EEMEM ee_COSD_FLAGS_MODES = 0;
38
uint8_t EEMEM ee_COSD_FLAGS_CONFIG = 0;
497 cascade 39
uint8_t EEMEM ee_COSD_DISPLAYMODE = 0;
902 - 40
uint8_t EEMEM ee_COSD_SCOPE [12] = {
41
    5, 5, 0,
42
    25, 5, 0,
43
    5, 10, 0,
44
    25, 10, 0
837 - 45
};
471 cascade 46
 
474 cascade 47
// video modes
489 woggle 48
const char VM_PAL[] PROGMEM = "PAL ";
49
const char VM_NTSC[] PROGMEM = "NTSC";
474 cascade 50
 
497 cascade 51
const displaymode_t * mode;
52
 
783 - 53
const char ee_message0[] PROGMEM = "Loading from EEPROM";
54
const char ee_message1[] PROGMEM = "No Data in EEPROM";
514 cascade 55
const char* ee_msg[] PROGMEM = {ee_message0, ee_message1};
56
 
471 cascade 57
/**
474 cascade 58
 * read data saved in eeprom, print out message if <verbose> is set
471 cascade 59
 */
474 cascade 60
void get_eeprom(uint8_t verbose) {
761 - 61
    if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) {
783 - 62
        if (verbose) write_ascii_string_pgm(2, 2, ee_msg[0]); // Loading data
761 - 63
        COSD_FLAGS_MODES = eeprom_read_byte(&ee_COSD_FLAGS_MODES);
64
        COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG);
65
        COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE);
66
        //if (verbose) write_ndigit_number_u(23, 11, COSD_DISPLAYMODE, 2, 0);
902 - 67
        for (int i = 0; i < 12; i++) {
837 - 68
            scope[i] = eeprom_read_byte(&ee_COSD_SCOPE[i]);
69
        }
761 - 70
    } else {
783 - 71
        if (verbose) write_ascii_string_pgm(2, 2, ee_msg[1]); // Loading data
761 - 72
    }
471 cascade 73
}
74
 
75
/**
76
 * save data to eeprom
77
 */
78
void save_eeprom() {
761 - 79
    eeprom_write_byte(&ee_checkbyte1, CHECKBYTE1);
80
    eeprom_write_byte(&ee_checkbyte2, CHECKBYTE2);
81
    eeprom_write_byte(&ee_COSD_FLAGS_MODES, COSD_FLAGS_MODES);
82
    eeprom_write_byte(&ee_COSD_FLAGS_CONFIG, COSD_FLAGS_CONFIG);
83
    eeprom_write_byte(&ee_COSD_DISPLAYMODE, COSD_DISPLAYMODE);
902 - 84
    for (int i = 0; i < 12; i++) {
837 - 85
        eeprom_write_byte(&ee_COSD_SCOPE[i], scope[i]);
86
    }
471 cascade 87
}
88
 
89
/**
90
 * auto config some stuff on startup, currently only battery cells
91
 */
92
void init_cosd(uint8_t UBat) {
93
    clear();
783 - 94
    write_ascii_string_pgm(2, 1, PSTR("C-OSD Init"));
95
    write_ascii_string_pgm(2, 4, PSTR(BUILDDATE));
96
 
471 cascade 97
#if FCONLY
783 - 98
    write_ascii_string_pgm(2, 3, PSTR("FC only Mode"));
471 cascade 99
#else
783 - 100
    write_ascii_string_pgm(2, 3, PSTR("NaviCtrl Mode"));
101
 
800 - 102
    usart1_EnableTXD();
103
    usart1_puts_pgm(PSTR(REQUEST_UART_TO_FC));
104
    usart1_DisableTXD();
471 cascade 105
#endif
783 - 106
 
107
 
800 - 108
    usart1_request_blocking('Q', PSTR(REQUEST_CURRENT_SETTING));
783 - 109
 
800 - 110
    //write_ascii_char(4 + 12 * 30, rxd_buffer[2]);
783 - 111
 
112
    paramset_serial setting;
113
    setting = *((paramset_serial*)pRxData);
114
 
835 - 115
    write_ascii_string_pgm(2, 6, PSTR("Setting  :"));
116
    write_ndigit_number_u(10, 6, setting.SettingsIndex, 1, 1);
800 - 117
    write_ascii_string_len(13, 6, setting.param.Name, 12);
783 - 118
 
800 - 119
    uint8_t cells = 0;
120
    write_ascii_string_pgm(2, 8, PSTR("Battery:")); // Guessing Number of Cells
121
    if (CELL_NUM == -1) {
122
#define MAX_CELL_VOLTAGE 43 // max cell volatage for LiPO
783 - 123
 
800 - 124
        if (setting.param.UnterspannungsWarnung < 50) {
125
            // up to 6s LiPo, less than 2s is technical impossible
126
            for (cells = 2; cells < 7; cells++) {
127
                if (UBat < cells * MAX_CELL_VOLTAGE) break;
128
            }
129
 
130
            min_voltage = cells * setting.param.UnterspannungsWarnung;
131
        } else {
132
            min_voltage = setting.param.UnterspannungsWarnung;
133
            cells = min_voltage / CELL_VOLT_MIN;
134
        }
135
        //write_ndigit_number_u(10, 13, setting.param.UnterspannungsWarnung, 3, 1);
471 cascade 136
    } else {
783 - 137
        cells = CELL_NUM;
800 - 138
        min_voltage = cells * CELL_VOLT_MIN;
471 cascade 139
    }
140
 
800 - 141
    max_voltage = cells * CELL_VOLT_MAX;
142
 
783 - 143
    write_ndigit_number_u(11, 8, cells, 1, 0);
800 - 144
    write_ascii_string_pgm(13, 8, PSTR("Cells")); // Number of Cells
783 - 145
    write_ascii_string_pgm(2, 9, PSTR("Warn:")); // Warn Voltage
146
    write_ndigit_number_s_10th(8, 9, min_voltage, 3, 0);
147
    write_ascii_string_pgm(14, 9, PSTR("Max:")); // Max Voltage
148
    write_ndigit_number_s_10th(20, 9, max_voltage, 3, 0);
149
 
761 - 150
    get_eeprom(1);
471 cascade 151
 
474 cascade 152
    //write_ascii_string_pgm(23, 2, vm[COSD_FLAGS & COSD_FLAG_NTSC]);
761 - 153
    if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
783 - 154
        write_ascii_string_pgm(23, 1, VM_NTSC);
761 - 155
    } else {
783 - 156
        write_ascii_string_pgm(23, 1, VM_PAL);
761 - 157
    }
474 cascade 158
 
761 - 159
    // request version from board
160
#if FCONLY
161
    //usart1_request_mk_data(0, 'v', 0);
162
    write_ascii_string_pgm(2, 11, PSTR("FC VERSION: ........"));
800 - 163
    usart1_request_blocking('V', PSTR(REQUEST_FC_VERSION));
761 - 164
#else
800 - 165
    usart1_request_nc_uart();
826 - 166
    _delay_ms(200);
167
    usart1_request_nc_uart();
837 - 168
 
761 - 169
    //usart1_request_mk_data(1, 'v', 0);
170
    write_ascii_string_pgm(2, 11, PSTR("NC VERSION: ........"));
800 - 171
    usart1_request_blocking('V', PSTR(REQUEST_NC_VERSION));
761 - 172
#endif
173
    str_VersionInfo VersionInfo;
174
    VersionInfo = *((str_VersionInfo*)pRxData);
497 cascade 175
 
761 - 176
    write_ndigit_number_u(14, 11, VersionInfo.SWMajor, 3, 1);
177
    write_ndigit_number_u(18, 11, VersionInfo.SWMinor, 3, 1);
178
    write_ascii_char(22 + 11 * 30, 'a' + VersionInfo.SWPatch);
179
    // end version request
677 cascade 180
 
497 cascade 181
 
783 - 182
 
183
 
761 - 184
#if FCONLY
185
    COSD_DISPLAYMODE %= (sizeof (fcdisplaymodes) / sizeof (displaymode_t));
186
    mode = fcdisplaymodes;
187
    mode += COSD_DISPLAYMODE;
188
    osd_fcmode = (int(*)(void)) pgm_read_word(&mode->dfun);
189
    // re-request data ever 100ms from FC;
190
    //usart1_request_mk_data(0, 'd', 100);
191
#else
192
    COSD_DISPLAYMODE %= (sizeof (ncdisplaymodes) / sizeof (displaymode_t));
193
    mode = ncdisplaymodes;
194
    mode += COSD_DISPLAYMODE;
195
    osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun);
196
    // re-request OSD Data from NC every 100ms
197
    //usart1_request_mk_data(1, 'o', 100);
198
#endif
199
 
783 - 200
    _delay_ms(5000);
471 cascade 201
    clear();
202
    // update flags to paint display again because of clear
523 cascade 203
    COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
826 - 204
 
205
    // we got data
206
    COSD_FLAGS_RUNTIME |= COSD_DATARECEIVED;
471 cascade 207
}
208
 
209
/* ##########################################################################
210
 * A simple config menu for the flags
211
 * ##########################################################################*/
212
 
213
/**
736 cascade 214
 * helper function for flag display
215
 */
761 - 216
void onoff(uint8_t col, uint8_t line, uint8_t onoff) {
217
    if (onoff) {
218
        write_ascii_string_pgm(col, line, PSTR("ON "));
219
    } else {
220
        write_ascii_string_pgm(col, line, PSTR("OFF"));
221
    }
736 cascade 222
}
223
 
224
/**
471 cascade 225
 * helper function for menu updating
226
 */
227
void config_menu_drawings(uint8_t chosen) {
761 - 228
    static uint8_t old_y = 0;
229
    uint8_t x = MENU_LEFT, y = MENU_TOP, line = MENU_TOP;
902 - 230
    //************************************************* 13 to 14
231
    if (chosen > 6 && chosen < 15) { // right
761 - 232
        x = MENU_MIDDLE;
902 - 233
        y = chosen - 7 + MENU_TOP;
234
    } else if (chosen < 8) {
761 - 235
        y = chosen + MENU_TOP;
236
    } else {
902 - 237
        y = chosen - 7 + MENU_TOP;
761 - 238
    }
757 cascade 239
 
240
    // clear prevoius _cursor_ and draw current
761 - 241
    for (uint8_t myx = MENU_LEFT; myx < 29; myx++) {
242
        write_char_att_xy(myx, old_y, 0);
243
        if (myx > x - 1 && myx < x + 14) {
244
            write_char_att_xy(myx, y, BLACKBG | INVERT);
245
        }
246
    };
474 cascade 247
 
761 - 248
    write_ascii_string_pgm(MENU_LEFT, line, PSTR("Video"));
249
    if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
250
        write_ascii_string_pgm(MENU_LEFT + 10, line, VM_NTSC);
251
    } else {
252
        write_ascii_string_pgm(MENU_LEFT + 10, line, VM_PAL);
253
    }
757 cascade 254
 
761 - 255
    write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Full HUD"));
256
    onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_HUD);
257
 
258
    write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Horizon"));
259
    onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON);
260
 
261
    write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Aggr.Hor."));
262
    onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_AGGRHORIZON);
263
 
264
    write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Stats"));
757 cascade 265
    onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_STATS);
736 cascade 266
 
761 - 267
    write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("A by FC"));
268
    onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT);
736 cascade 269
 
902 - 270
    write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("GPS Pos"));
271
    onoff(MENU_LEFT + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_COORDS);
272
 
761 - 273
    // 2nd col
274
    line = 2;
736 cascade 275
 
761 - 276
    write_ascii_string_pgm(MENU_MIDDLE, line, PSTR("V C-Strom"));
277
    onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT);
736 cascade 278
 
761 - 279
    write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Height by"));
280
    if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
281
        write_ascii_string_pgm(MENU_MIDDLE + 10, line, PSTR(" GPS"));
282
    } else {
283
        write_ascii_string_pgm(MENU_MIDDLE + 10, line, PSTR("BARO"));
284
    }
757 cascade 285
 
761 - 286
    write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Feet/mph"));
287
    onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_FEET);
757 cascade 288
 
761 - 289
    write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Big Vario"));
290
    onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO);
757 cascade 291
 
902 - 292
    write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Big Speed"));
293
    onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_BIGSPEED);
294
 
826 - 295
    write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Passive"));
296
    onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_PASSIVE);
757 cascade 297
 
837 - 298
    write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Cam Scope"));
299
    onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_SCOPE);
826 - 300
 
837 - 301
    write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Move Scope"));
302
 
303
 
761 - 304
    // bottom
902 - 305
    write_ascii_string_pgm(MENU_LEFT, 10, PSTR("Reset uptime"));
757 cascade 306
 
902 - 307
    write_ascii_string_pgm(MENU_LEFT, 11, PSTR("Display Mode"));
308
    write_ascii_string_pgm(15, 11, (const char *)(pgm_read_word(&(mode->desc))));
761 - 309
 
902 - 310
    write_ascii_string_pgm(MENU_LEFT, 12, PSTR("Save config"));
311
    write_ascii_string_pgm(MENU_LEFT, 13, PSTR("EXIT"));
761 - 312
 
313
    old_y = y;
471 cascade 314
}
315
 
316
/**
317
 * some sort of clicking response in the menu
318
 */
736 cascade 319
void config_menu_doclick(uint8_t chosen) {
932 - 320
    write_ascii_string_pgm(MENU_LEFT, chosen + MENU_TOP - 7, PSTR("DONE              "));
471 cascade 321
    _delay_ms(500);
736 cascade 322
    config_menu_drawings(chosen);
471 cascade 323
}
324
 
325
/**
837 - 326
 * move around the four scope edges
327
 */
328
void move_scope() {
329
    uint8_t mode = 0;
330
    clear();
331
    draw_scope();
332
    _delay_ms(500);
902 - 333
    while (mode < 12) {
837 - 334
        if (s2_pressed()) { // next
335
            mode++;
336
            _delay_ms(500);
337
        } else if (s1_pressed()) {
902 - 338
            if (mode % 3 == 2) {
339
                scope[mode] = (scope[mode] + 1) % 2;
340
            } else {
341
                scope[mode] = (scope[mode] + 1) % ((mode % 3) % 2 == 0 ? 30 : bottom_line);
342
            }
837 - 343
            clear();
344
            draw_scope();
345
            _delay_ms(100);
346
        }
347
    }
348
    clear();
349
}
350
 
351
/**
471 cascade 352
 * a simple config menu tryout
353
 */
354
void config_menu(void) {
355
    // disable interrupts (makes the menu more smoothely)
356
    cli();
357
 
358
    // clear screen
359
    clear();
360
 
361
    uint8_t chosen = 0;
761 - 362
    uint8_t inmenu = 1;
523 cascade 363
    write_ascii_string_pgm(6, 1, PSTR("C-OSD Config Menu"));
471 cascade 364
 
365
    // wait a bit before doing stuff so user has chance to release button
366
    _delay_ms(250);
367
 
368
    config_menu_drawings(chosen);
369
 
370
    while (inmenu) {
371
        if (s2_pressed()) {
902 - 372
            chosen = (chosen + 1) % 19;
837 - 373
            //if (chosen == 12) chosen = 13; // SKIP unused menu space for now
761 - 374
            config_menu_drawings(chosen);
375
            _delay_ms(500);
471 cascade 376
        } else if (s1_pressed()) {
377
            switch (chosen) {
523 cascade 378
                case 0: // NTSC or PAL
379
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_NTSC;
761 - 380
                    // Setup Video Mode
381
                    if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
382
                        // NTSC + enable display immediately (VM0)
383
                        spi_send_byte(0x00, 0b00001000);
474 cascade 384
 
761 - 385
                        bottom_line = 12;
386
                    } else {
387
                        // PAL + enable display immediately (VM0)
388
                        spi_send_byte(0x00, 0b01001000);
474 cascade 389
 
761 - 390
                        bottom_line = 14;
391
                    }
474 cascade 392
                    break;
393
                case 1: // full HUD
523 cascade 394
                    COSD_FLAGS_MODES ^= COSD_FLAG_HUD;
471 cascade 395
                    break;
474 cascade 396
                case 2: // art horizon
523 cascade 397
                    COSD_FLAGS_MODES ^= COSD_FLAG_ARTHORIZON;
471 cascade 398
                    break;
757 cascade 399
                case 3: // aggressiva horizon
400
                    COSD_FLAGS_MODES ^= COSD_FLAG_AGGRHORIZON;
471 cascade 401
                    break;
474 cascade 402
                case 4: // statistics
523 cascade 403
                    COSD_FLAGS_MODES ^= COSD_FLAG_STATS;
471 cascade 404
                    break;
728 cascade 405
                case 5: // current by fc
406
                    COSD_FLAGS_MODES ^= COSD_FLAG_FCCURRENT;
471 cascade 407
                    break;
902 - 408
                case 6: // GPS coordinates while flying
409
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_SHOW_COORDS;
410
                    break;
411
                case 7: // 2nd voltage by c-strom
523 cascade 412
                    COSD_FLAGS_MODES ^= COSD_FLAG_STROMVOLT;
507 cascade 413
                    break;
902 - 414
                case 8: // GPS or BARO height
757 cascade 415
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_GPSHEIGHT;
416
                    break;
902 - 417
                case 9: // Feet and mph?
757 cascade 418
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_FEET;
419
                    break;
902 - 420
                case 10: // big vario
757 cascade 421
                    COSD_FLAGS_MODES ^= COSD_FLAG_BIGVARIO;
422
                    break;
902 - 423
                case 11: // big Speed
424
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_BIGSPEED;
425
                    break;
426
                case 12: // passive
826 - 427
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_PASSIVE;
428
                    break;
902 - 429
                case 13: // scope
837 - 430
                    COSD_FLAGS_CONFIG ^= COSD_FLAG_SHOW_SCOPE;
431
                    break;
902 - 432
                case 14: // move scope
837 - 433
                    move_scope();
434
                    break;
902 - 435
                case 15: // reset uptime
471 cascade 436
                    uptime = 0;
761 - 437
                    config_menu_doclick(chosen);
471 cascade 438
                    break;
902 - 439
                case 16: // change mode
761 - 440
#if FCONLY
441
                    COSD_DISPLAYMODE = (COSD_DISPLAYMODE + 1) % (sizeof (fcdisplaymodes) / sizeof (displaymode_t));
442
                    mode = fcdisplaymodes;
443
                    mode += COSD_DISPLAYMODE;
444
                    osd_fcmode = (int(*)(void)) pgm_read_word(&mode->dfun);
445
#else
446
                    COSD_DISPLAYMODE = (COSD_DISPLAYMODE + 1) % (sizeof (ncdisplaymodes) / sizeof (displaymode_t));
447
                    mode = ncdisplaymodes;
448
                    mode += COSD_DISPLAYMODE;
449
                    osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun);
450
#endif
471 cascade 451
                    break;
902 - 452
                case 17: // save
471 cascade 453
                    save_eeprom();
761 - 454
                    config_menu_doclick(chosen);
471 cascade 455
                    break;
902 - 456
                case 18: // exit
761 - 457
                    inmenu = 0;
458
                    config_menu_doclick(chosen);
471 cascade 459
                    break;
460
            }
761 - 461
            config_menu_drawings(chosen);
471 cascade 462
            _delay_ms(250);
463
        }
464
    }
465
 
466
    // clear screen up again
467
    clear();
468
 
469
    // update flags to paint display again if needed
523 cascade 470
    COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
471 cascade 471
 
472
    // enable interrupts again
473
    sei();
474
}
475
 
476
#endif