Subversion Repositories Projects

Rev

Rev 453 | Rev 459 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 453 Rev 454
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje                    *
2
 *   Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje                    *
3
 *   admiralcascade@gmail.com                                               *
3
 *   admiralcascade@gmail.com                                               *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
5
 *                                                                          *
5
 *                                                                          *
6
 *   This program is free software; you can redistribute it and/or modify   *
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   *
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.         *
8
 *   the Free Software Foundation; either version 2 of the License.         *
9
 *                                                                          *
9
 *                                                                          *
10
 *   This program is distributed in the hope that it will be useful,        *
10
 *   This program is distributed in the hope that it will be useful,        *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
13
 *   GNU General Public License for more details.                           *
13
 *   GNU General Public License for more details.                           *
14
 *                                                                          *
14
 *                                                                          *
15
 *   You should have received a copy of the GNU General Public License      *
15
 *   You should have received a copy of the GNU General Public License      *
16
 *   along with this program; if not, write to the                          *
16
 *   along with this program; if not, write to the                          *
17
 *   Free Software Foundation, Inc.,                                        *
17
 *   Free Software Foundation, Inc.,                                        *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
19
 ****************************************************************************/
19
 ****************************************************************************/
20
 
20
 
21
/* ##########################################################################
21
/* ##########################################################################
22
 * Debugging and general purpose definitions
22
 * Debugging and general purpose definitions
23
 * ##########################################################################*/
23
 * ##########################################################################*/
24
#define ALLCHARSDEBUG 0         // set to 1 and flash firmware to see all chars
24
#define ALLCHARSDEBUG 0         // set to 1 and flash firmware to see all chars
25
 
25
 
26
#ifndef WRITECHARS                      // if WRITECHARS not set via makefile
26
#ifndef WRITECHARS                      // if WRITECHARS not set via makefile
27
#define WRITECHARS -1           // set to XXX and flash firmware to write new char
27
#define WRITECHARS -1           // set to XXX and flash firmware to write new char
28
                                                        // enables the allchars as well to see results
28
                                                        // enables the allchars as well to see results
29
                                                        // currently in use:
29
                                                        // currently in use:
30
                                                        // 112, 128, 136, 144, 152, 160, 168, 176, 184
30
                                                        // 112, 128, 136, 144, 152, 160, 168, 176, 184
31
                                                        // 192, 200, 208, 216, 224, 232
31
                                                        // 192, 200, 208, 216, 224, 232
32
#endif
32
#endif
33
 
33
 
34
#ifndef NTSC                            // if NTSC is not thet via makefile
34
#ifndef NTSC                            // if NTSC is not thet via makefile
35
#define NTSC 0                          // set to 1 for NTSC mode + lifts the bottom line
35
#define NTSC 0                          // set to 1 for NTSC mode + lifts the bottom line
36
#endif
36
#endif
-
 
37
 
-
 
38
#define FCONLY 0                        // set to 1 if you do NOT have a NaviCtrl and the OSD is
37
 
39
                                                        // connected to the FC directly
38
#define HUD 1                           // set to 0 to disable HUD by default
40
#define HUD 1                           // set to 0 to disable HUD by default
39
#define ARTHORIZON 0            // set to 1 to enable roll&nick artificial horizon by default
41
#define ARTHORIZON 0            // set to 1 to enable roll&nick artificial horizon by default
40
#define BIGVARIO 0                      // set to 1 to enable the big vario bar on right side
42
#define BIGVARIO 0                      // set to 1 to enable the big vario bar on right side
41
#define STATS 1                         // set to 1 to enable statistics during motor off by default
43
#define STATS 1                         // set to 1 to enable statistics during motor off by default
42
#define WARNINGS 1                      // set to 1 to display battery+rc warning even if HUD is disabled
44
#define WARNINGS 1                      // set to 1 to display battery+rc warning even if HUD is disabled
43
 
45
 
44
//#define UBAT_WRN  94          // voltage for blinking warning, like FC settings (deprecated)
46
//#define UBAT_WRN  94          // voltage for blinking warning, like FC settings (deprecated)
45
//#define UBAT_MAX 114          // maximal battery voltage for battery-sign (deprecated)
47
//#define UBAT_MAX 114          // maximal battery voltage for battery-sign (deprecated)
46
#define CELL_VOLT_MAX 37        // max voltage per battery cell (37 for LiPo)
48
#define CELL_VOLT_MAX 37        // max voltage per battery cell (37 for LiPo)
47
#define CELL_VOLT_MIN 32        // min voltage per battery cell (maybe 32 for LiPo?)
49
#define CELL_VOLT_MIN 32        // min voltage per battery cell (maybe 32 for LiPo?)
48
#define CELL_NUM -1                     // -1 for auto, 3 for 3s1p and 4 for 4s1p
50
#define CELL_NUM -1                     // -1 for auto, 3 for 3s1p and 4 for 4s1p
49
#define RCLVL_WRN 100           // make the RC level blink if below this number
51
#define RCLVL_WRN 100           // make the RC level blink if below this number
50
 
52
 
51
// ### read datasheet before changing stuff below this line :)
53
// ### read datasheet before changing stuff below this line :)
52
#define BLINK   0b01001111      // attribute byte for blinking chars
54
#define BLINK   0b01001111      // attribute byte for blinking chars
53
 
55
 
54
/* ##########################################################################
56
/* ##########################################################################
55
 * FLAGS usable during runtime
57
 * FLAGS usable during runtime
56
 * ##########################################################################*/
58
 * ##########################################################################*/
57
#define COSD_FLAG_NTSC                    1
59
#define COSD_FLAG_NTSC                    1
58
#define COSD_FLAG_HUD                     2
60
#define COSD_FLAG_HUD                     2
59
#define COSD_FLAG_ARTHORIZON      4
61
#define COSD_FLAG_ARTHORIZON      4
60
#define COSD_FLAG_BIGVARIO                8
62
#define COSD_FLAG_BIGVARIO                8
61
#define COSD_FLAG_STATS                  16
63
#define COSD_FLAG_STATS                  16
62
#define COSD_FLAG_WARNINGS               32
64
#define COSD_FLAG_WARNINGS               32
63
#define COSD_ICONS_WRITTEN               64
65
#define COSD_ICONS_WRITTEN               64
64
#define COSD_WASFLYING                  128
66
#define COSD_WASFLYING                  128
65
 
67
 
66
/* ##########################################################################
68
/* ##########################################################################
67
 * LED controll
69
 * LED controll
68
 * ##########################################################################*/
70
 * ##########################################################################*/
69
#define LED1_ON                 PORTC |=  (1 << PC0);
71
#define LED1_ON                 PORTC |=  (1 << PC0);
70
#define LED1_OFF                PORTC &= ~(1 << PC0);
72
#define LED1_OFF                PORTC &= ~(1 << PC0);
71
#define LED2_ON                 PORTC |=  (1 << PC1);
73
#define LED2_ON                 PORTC |=  (1 << PC1);
72
#define LED2_OFF                PORTC &= ~(1 << PC1);
74
#define LED2_OFF                PORTC &= ~(1 << PC1);
73
#define LED3_ON                 PORTC |=  (1 << PC2);
75
#define LED3_ON                 PORTC |=  (1 << PC2);
74
#define LED3_OFF                PORTC &= ~(1 << PC2);
76
#define LED3_OFF                PORTC &= ~(1 << PC2);
75
#define LED4_ON                 PORTC |=  (1 << PC3);
77
#define LED4_ON                 PORTC |=  (1 << PC3);
76
#define LED4_OFF                PORTC &= ~(1 << PC3);
78
#define LED4_OFF                PORTC &= ~(1 << PC3);
77
 
79
 
78
/* ##########################################################################
80
/* ##########################################################################
79
 * switch controll
81
 * switch controll
80
 * ##########################################################################*/
82
 * ##########################################################################*/
81
#define S1_PRESSED              !(PINC & (1<<PC5))
83
#define S1_PRESSED              !(PINC & (1<<PC5))
82
#define S2_PRESSED              !(PINC & (1<<PC4))
84
#define S2_PRESSED              !(PINC & (1<<PC4))
83
 
85
 
84
 
86