Subversion Repositories Projects

Rev

Rev 465 | Rev 495 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/****************************************************************************
 *   Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje                    *
 *   admiralcascade@gmail.com                                               *
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
 *                                                                          *
 *   This program is free software; you can redistribute it and/or modify   *
 *   it under the terms of the GNU General Public License as published by   *
 *   the Free Software Foundation; either version 2 of the License.         *
 *                                                                          *
 *   This program is distributed in the hope that it will be useful,        *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 *   GNU General Public License for more details.                           *
 *                                                                          *
 *   You should have received a copy of the GNU General Public License      *
 *   along with this program; if not, write to the                          *
 *   Free Software Foundation, Inc.,                                        *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
 ****************************************************************************/


/* ##########################################################################
 * Debugging and general purpose definitions
 * ##########################################################################*/

#ifndef BUILDDATE
#define BUILDDATE "DEVEL-BUILD" // build date, this is testing...
#endif

#define ALLCHARSDEBUG 0         // set to 1 and flash firmware to see all chars

#ifndef WRITECHARS              // if WRITECHARS not set via makefile
#define WRITECHARS -1           // set to XXX and flash firmware to write new char
                                // enables the allchars as well to see results
                                // currently in use:
                                // 112, 128, 136, 144, 152, 160, 168, 176, 184
                                // 192, 200, 208, 216, 224, 232
#endif

#ifndef NTSC                    // if NTSC is not thet via makefile
#define NTSC 0                  // set to 1 for NTSC mode + lifts the bottom line
#endif

#ifndef FCONLY
#define FCONLY 0                // set to 1 if you do NOT have a NaviCtrl and the OSD is
#endif                          // connected to the FC directly

#define HUD 1                   // set to 0 to disable HUD by default
#define ARTHORIZON 0            // set to 1 to enable roll&nick artificial horizon by default
#define BIGVARIO 0                      // set to 1 to enable the big vario bar on right side
#define STATS 1                         // set to 1 to enable statistics during motor off by default
#define WARNINGS 1                      // set to 1 to display battery+rc warning even if HUD is disabled

//#define UBAT_WRN  94          // voltage for blinking warning, like FC settings (deprecated)
//#define UBAT_MAX 114          // maximal battery voltage for battery-sign (deprecated)
#define CELL_VOLT_MAX 37        // max voltage per battery cell (37 for LiPo)
#define CELL_VOLT_MIN 32        // min voltage per battery cell (maybe 32 for LiPo?)
#define CELL_NUM -1                     // -1 for auto, 3 for 3s1p and 4 for 4s1p
#define RCLVL_WRN 100           // make the RC level blink if below this number

// ### read datasheet before changing stuff below this line :)
#define BLINK   0b01001111      // attribute byte for blinking chars

/* ##########################################################################
 * FLAGS usable during runtime that get saved
 * ##########################################################################*/

#define COSD_FLAG_NTSC                    1
#define COSD_FLAG_HUD                     2
#define COSD_FLAG_ARTHORIZON      4
#define COSD_FLAG_BIGVARIO                8
#define COSD_FLAG_STATS                  16
#define COSD_FLAG_WARNINGS               32

/* ##########################################################################
 * FLAGS only usable during runtime (not saved)
 * ##########################################################################*/

#define COSD_FLAG_STROMREC                1
#define COSD_ICONS_WRITTEN                2
#define COSD_WASFLYING                    4

/* ##########################################################################
 * LED controll
 * ##########################################################################*/

#define LED1_ON                 PORTC |=  (1 << PC0);
#define LED1_OFF                PORTC &= ~(1 << PC0);
#define LED2_ON                 PORTC |=  (1 << PC1);
#define LED2_OFF                PORTC &= ~(1 << PC1);
#define LED3_ON                 PORTC |=  (1 << PC2);
#define LED3_OFF                PORTC &= ~(1 << PC2);
#define LED4_ON                 PORTC |=  (1 << PC3);
#define LED4_OFF                PORTC &= ~(1 << PC3);

/* ##########################################################################
 * switch controll
 * ##########################################################################*/

#define S1_PRESSED              !(PINC & (1<<PC5))
#define S2_PRESSED              !(PINC & (1<<PC4))

/* ##########################################################################
 * extern spi controlled vars
 * ##########################################################################*/

extern volatile uint16_t icnt;
extern volatile unsigned char * iptr;
extern volatile unsigned char spi_cmd_buffer[];
extern volatile uint8_t spi_ready;
extern int16_t ampere, max_ampere;
extern int32_t ampere_wasted;