Rev 1199 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1199 | Rev 1437 | ||
---|---|---|---|
1 | /**************************************************************************** |
1 | /**************************************************************************** |
2 | * Copyright (C) 2011 by Claas Anders "CaScAdE" Rathje * |
2 | * Copyright (C) 2011-2012 by Claas Anders "CaScAdE" Rathje * |
3 | * admiralcascade@gmail.com * |
3 | * admiralcascade@gmail.com * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-epilepsy/ * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-epilepsy/ * |
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 | #ifndef _MAIN_H |
21 | #ifndef _MAIN_H |
22 | #define _MAIN_H |
22 | #define _MAIN_H |
23 | 23 | ||
24 | 24 | ||
25 | #ifndef MCU |
25 | #ifndef MCU |
26 | #define MCU atmega644p |
26 | #define MCU atmega644p |
27 | //#ifndef __AVR_ATmega644P__ |
27 | //#ifndef __AVR_ATmega644P__ |
28 | //#define __AVR_ATmega644P__ |
28 | //#define __AVR_ATmega644P__ |
29 | //#endif |
29 | //#endif |
30 | #endif |
30 | #endif |
31 | 31 | ||
32 | #define EPI10AQ41 01 /* the grey one done by akku by hand */ |
32 | #define EPI10AQ41 01 /* the grey one done by akku by hand */ |
33 | #define EPI10 10 |
33 | #define EPI10 10 |
34 | #define EPI11 11 |
34 | #define EPI11 11 |
35 | 35 | ||
36 | //#define HWVERSION HW_10AQ41 |
36 | //#define HWVERSION HW_10AQ41 |
37 | 37 | ||
38 | #ifndef HWVERSION |
38 | #ifndef HWVERSION |
39 | #define HWVERSION EPI11 |
39 | #define HWVERSION EPI11 |
40 | #endif |
40 | #endif |
41 | 41 | ||
42 | #if HWVERSION == EPI10AQ41 |
42 | #if HWVERSION == EPI10AQ41 |
43 | 43 | ||
44 | #define LEDGREEN_ON PORTB |= (1 << PB1); |
44 | #define LEDGREEN_ON PORTB |= (1 << PB1); |
45 | #define LEDGREEN_OFF PORTB &= ~(1 << PB1); |
45 | #define LEDGREEN_OFF PORTB &= ~(1 << PB1); |
46 | #define LEDGREEN_TOGGLE PORTB ^= (1 << PB1); |
46 | #define LEDGREEN_TOGGLE PORTB ^= (1 << PB1); |
47 | #define LEDRED_ON PORTB |= (1 << PB2); |
47 | #define LEDRED_ON PORTB |= (1 << PB2); |
48 | #define LEDRED_OFF PORTB &= ~(1 << PB2); |
48 | #define LEDRED_OFF PORTB &= ~(1 << PB2); |
49 | #define LEDRED_TOGGLE PORTB ^= (1 << PB2); |
49 | #define LEDRED_TOGGLE PORTB ^= (1 << PB2); |
50 | 50 | ||
51 | #elif HWVERSION == EPI10 |
51 | #elif HWVERSION == EPI10 |
52 | 52 | ||
53 | #define LEDGREEN_ON PORTD |= (1 << PD7); |
53 | #define LEDGREEN_ON PORTD |= (1 << PD7); |
54 | #define LEDGREEN_OFF PORTD &= ~(1 << PD7); |
54 | #define LEDGREEN_OFF PORTD &= ~(1 << PD7); |
55 | #define LEDGREEN_TOGGLE PORTD ^= (1 << PD7); |
55 | #define LEDGREEN_TOGGLE PORTD ^= (1 << PD7); |
56 | #define LEDRED_ON PORTD |= (1 << PD3); |
56 | #define LEDRED_ON PORTD |= (1 << PD3); |
57 | #define LEDRED_OFF PORTD &= ~(1 << PD3); |
57 | #define LEDRED_OFF PORTD &= ~(1 << PD3); |
58 | #define LEDRED_TOGGLE PORTD ^= (1 << PD3); |
58 | #define LEDRED_TOGGLE PORTD ^= (1 << PD3); |
59 | 59 | ||
60 | #else |
60 | #else |
61 | 61 | ||
62 | #define LEDGREEN_ON PORTD |= (1 << PD7); |
62 | #define LEDGREEN_ON PORTD |= (1 << PD7); |
63 | #define LEDGREEN_OFF PORTD &= ~(1 << PD7); |
63 | #define LEDGREEN_OFF PORTD &= ~(1 << PD7); |
64 | #define LEDGREEN_TOGGLE PORTD ^= (1 << PD7); |
64 | #define LEDGREEN_TOGGLE PORTD ^= (1 << PD7); |
65 | #define LEDRED_ON PORTD &= ~(1 << PD7); |
65 | #define LEDRED_ON PORTD &= ~(1 << PD7); |
66 | #define LEDRED_OFF PORTD |= (1 << PD7); |
66 | #define LEDRED_OFF PORTD |= (1 << PD7); |
67 | #define LEDRED_TOGGLE PORTD ^= (1 << PD7); |
67 | #define LEDRED_TOGGLE PORTD ^= (1 << PD7); |
68 | 68 | ||
69 | #endif |
69 | #endif |
70 | 70 | ||
71 | 71 | ||
72 | #include <avr/eeprom.h> |
72 | #include <avr/eeprom.h> |
73 | #include <avr/io.h> |
73 | #include <avr/io.h> |
74 | #include <avr/interrupt.h> |
74 | #include <avr/interrupt.h> |
75 | #include <avr/pgmspace.h> |
75 | #include <avr/pgmspace.h> |
76 | #include <avr/wdt.h> |
76 | #include <avr/wdt.h> |
77 | #include <inttypes.h> |
77 | #include <inttypes.h> |
78 | //#include <math.h> |
78 | //#include <math.h> |
79 | #include <stdint.h> |
79 | #include <stdint.h> |
80 | #include <stdlib.h> |
80 | #include <stdlib.h> |
81 | #include <util/delay.h> |
81 | #include <util/delay.h> |
82 | #include <string.h> |
82 | #include <string.h> |
83 | #include "timer0.h" |
83 | #include "timer0.h" |
84 | #include "timer1.h" |
84 | #include "timer1.h" |
85 | #include "led_out.h" |
85 | #include "led_out.h" |
86 | #include "player.h" |
86 | #include "player.h" |
87 | #include "usart0.h" |
87 | #include "usart0.h" |
88 | #include "usart1.h" |
88 | #include "usart1.h" |
89 | #include "mk-data-structs.h" |
89 | #include "mk-data-structs.h" |
90 | #include "epi_helpers.h" |
90 | #include "epi_helpers.h" |
91 | #include "integer_math.h" |
91 | #include "integer_math.h" |
92 | #include "nc_handler.h" |
92 | #include "nc_handler.h" |
93 | #include "buttons.h" |
93 | #include "buttons.h" |
94 | #include "eeprom.h" |
94 | #include "eeprom.h" |
95 | 95 | ||
96 | #ifndef BUILDDATE |
96 | #ifndef BUILDDATE |
97 | #define BUILDDATE "DEVEL-BUILD" // build date, this is testing... |
97 | #define BUILDDATE "DEVEL-BUILD" // build date, this is testing... |
98 | #endif |
98 | #endif |
99 | 99 | ||
100 | #ifndef FCONLY |
100 | #ifndef FCONLY |
101 | #define FCONLY 0 // set to 1 if you do NOT have a NaviCtrl and the Epilepsy is |
101 | #define FCONLY 0 // set to 1 if you do NOT have a NaviCtrl and the Epilepsy is |
102 | #endif // connected to the FC directly |
102 | #endif // connected to the FC directly |
103 | 103 | ||
104 | 104 | ||
105 | extern const uint8_t COLORS [][6]; |
105 | extern const uint8_t COLORS [][6]; |
106 | extern uint8_t main_mode; |
106 | extern uint8_t main_mode; |
107 | extern volatile uint8_t CEPILEPSYFLAGS; |
107 | extern volatile uint8_t CEPILEPSYFLAGS; |
108 | 108 | ||
109 | #define CEPI_DIRTYEEPROM 1 |
109 | #define CEPI_DIRTYEEPROM 1 |
110 | 110 | ||
111 | 111 | ||
112 | #endif |
112 | #endif |
113 | 113 |