Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1470 - 1
/*****************************************************************************
2
 *   Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de                  *
3
 *   Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net                  *
4
 *   Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net *
5
 *   Copyright (C) 2011 Harald Bongartz                                      *
6
 *                                                                           *
7
 *   This program is free software; you can redistribute it and/or modify    *
8
 *   it under the terms of the GNU General Public License as published by    *
9
 *   the Free Software Foundation; either version 2 of the License.          *
10
 *                                                                           *
11
 *   This program is distributed in the hope that it will be useful,         *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
14
 *   GNU General Public License for more details.                            *
15
 *                                                                           *
16
 *   You should have received a copy of the GNU General Public License       *
17
 *   along with this program; if not, write to the                           *
18
 *   Free Software Foundation, Inc.,                                         *
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.               *
20
 *                                                                           *
21
 *                                                                           *
22
 *   Credits to:                                                             *
23
 *   Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN  *
24
 *                          http://www.mikrokopter.de                        *
25
 *   Gregor "killagreg" Stobrawa for his version of the MK code              *
26
 *   Thomas Kaiser "thkais" for the original project. See                    *
27
 *                          http://www.ft-fanpage.de/mikrokopter/            *
28
 *                          http://forum.mikrokopter.de/topic-4061-1.html    *
29
 *   Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code *
30
 *                          http://www.mylifesucks.de/oss/c-osd/             *
31
 *   Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
32
 *****************************************************************************/
33
 
34
 
35
// *Hardwareabhängige Definitionen und Prozeduren
36
// * Hardware Leiterplatte V3.2 Cebra
37
// * USB,Wi232,LED
38
 
39
 
40
#ifndef HAL_HW3_2_C_
41
#define HAL_HW3_2_C_
42
 
43
 
44
 
45
 
46
#include "cpu.h"
47
#include <inttypes.h>
48
#include <avr/io.h>
49
#include <avr/interrupt.h>
50
#include <avr/pgmspace.h>
51
#include <avr/eeprom.h>
52
#include <util/delay.h>
53
#include "main.h"
54
 
55
#ifdef HWVERSION3_1
56
#include "lcd.h"
57
#include "usart.h"
58
#include "uart1.h"
59
#include "display.h"
60
#include "timer.h"
61
#include "eeprom.h"
62
#include "Wi232.h"
63
#include "twimaster.h"
64
 
65
 
66
 
67
 
68
 
69
void InitHWPorts(void)  /* Initialisierung der Hardware für die jeweilige Leiterplattenversion */
70
 
71
{
72
 
73
        // enable pull ups for the 4 keys
74
        PORTA |= (1<<PORTA4)|(1<<PORTA5)|(1<<PORTA6)|(1<<PORTA7);
75
 
76
        DDRD |= (1<<DDD7)|(1<<DDD6);
77
        DDRC |= (1<<DDC2)|(1<<DDC3)|(1<<DDC7); /* Leds,Summer*/
78
 
79
        DDRB = 0xFF;
80
        set_LED1();
81
        set_LED2();
82
        set_LED3();
83
        set_LED4();
84
 
85
        BeepTime = 500;
86
        BeepMuster = 0x0080;
87
 
88
        set_D_LIGHT();
89
        clr_WI232CMD();
90
        _delay_ms(250);
91
 
92
        clr_LED1();
93
        clr_LED2();
94
        clr_LED3();
95
        clr_LED4();
96
 
97
        Display_on = 1;
98
 
99
        LCD_Init ();
100
        USART_Init (UART_BAUD_SELECT(USART_BAUD,F_CPU));
101
 
102
        uart1_init (UART_BAUD_SELECT(USART_BAUD,F_CPU));      /* USB*/
103
        uart1_putc('R');
104
        I2C_Init(1);
105
 
106
        Timer0_Init ();
107
        Timer1_Init (); // pwm
108
//      TIMER2_Init();  //PWM Displaybeleuchtung
109
 
110
        sei ();
111
 
112
        ReadParameter ();
113
        LCD_Init ();
114
        InitWi232();
115
 
116
}
117
 
118
 
119
 
120
 
121
#endif
122
#endif /* HAL_HW3_2_C_ */