Subversion Repositories Projects

Rev

Blame | Last modification | View Log | RSS feed

/*****************************************************************************
 *   Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de                  *
 *   Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net                  *
 *                                                                           *
 *   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.               *
 *                                                                           *
 *                                                                           *
 *   Credits to:                                                             *
 *   Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN  *
 *                          http://www.mikrokopter.de                        *
 *   Gregor "killagreg" Stobrawa for his version of the MK code              *
 *   Thomas Kaiser "thkais" for the original project. See                    *
 *                          http://www.ft-fanpage.de/mikrokopter/            *
 *                          http://forum.mikrokopter.de/topic-4061-1.html    *
 *   Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code *
 *                          http://www.mylifesucks.de/oss/c-osd/             *
 *****************************************************************************/


#ifndef _MAIN_H
#define _MAIN_H


/* Fusebits für Hardware 1.2 D7 DF FF */
/* Fusebits für Hardware 1.3 */
/* Fusebits für Hardware 3.x */

/*****************************************************************************/
/* hier die entsprechende Hardwareversion der Leiterplatte einstellen */

//#define HWVERSION1_2  /* Hardware sebseb7*/
//#define HWVERSION1_3  /* Hardware sebseb7*/
#define HWVERSION3_1  /* Hardware Cebra Juni 2011*/

/*****************************************************************************/

#define set_cs()    (PORTB |=  (1 << PB4))
#define clr_cs()    (PORTB &= ~(1 << PB4))
#define set_reset() (PORTB |=  (1 << PB2))
#define clr_reset() (PORTB &= ~(1 << PB2))
#define set_A0()    (PORTB |=  (1 << PB3))                      // Data
#define clr_A0()    (PORTB &= ~(1 << PB3))                      // Command
#define set_scl()   (PORTB |=  (1 << PB7))
#define clr_scl()   (PORTB &= ~(1 << PB7))
#define set_si()    (PORTB |=  (1 << PB5))
#define clr_si()    (PORTB &= ~(1 << PB5))

#define set_LED1()      (PORTC &= ~(1 << PC3))
#define clr_LED1()      (PORTC |=  (1 << PC3))
#define set_LED2()      (PORTC &= ~(1 << PC2))
#define clr_LED2()      (PORTC |=  (1 << PC2))
#define set_LED3()      (PORTB &= ~(1 << PB1))
#define clr_LED3()      (PORTB |=  (1 << PB1))
#define set_LED4()      (PORTB &= ~(1 << PB0))
#define clr_LED4()      (PORTB |=  (1 << PB0))

#ifdef HWVERSION3_1
#define set_BEEP()      (PORTC &= ~(1 << PC6))
#define clr_BEEP()      (PORTC |=  (1 << PC6))
#endif

#ifdef HWVERSION3_3
#define set_BEEP()      (PORTC &= ~(1 << PC7))
#define clr_BEEP()      (PORTC |=  (1 << PC7))
#endif

#define set_D_LIGHT()   (PORTD |= (1 << PD7))
#define clr_D_LIGHT()   (PORTD &= ~(1 << PD7))
#define set_WI232CMD()  (PORTD &= ~(1 << PD6))
#define clr_WI232CMD()  (PORTD |=  (1 << PD6))

#define NO              0
#define NC              1
#define FC              2
#define MK3MAG  3
#define MKGPS   4
#define Wi232   5

#define ENABLE_PWM



//*****************************************************************************
//
extern volatile uint8_t mode;
extern uint8_t hardware;
extern uint8_t current_hardware;

#endif