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
#ifndef HAL_HW3_9_H_
36
#define HAL_HW3_9_H_
37
 
38
 
39
 
40
//#define PIEPSER_NERVT  // Summer zu Testzwecken ganz Ausschalten
41
 
42
 
43
// Hardware 3.9 Portbelegung
44
#define KEY_PIN                         PINA // Port A als Input
45
 
46
#define Touch0                          PA0  // Pin 37
47
#define Touch1                          PA1  // Pin 36
48
#define Touch2                          PA2  // Pin 35
49
#define Touch3                          PA3  // Pin 34
50
#define Key1                            PA4  // Pin 33
51
#define Key2                            PA5  // Pin 32
52
#define Key3                            PA6  // Pin 31
53
#define Key4                            PA7  // Pin 30
54
 
55
#define USB2Wi                          PB0  // Pin 40  aktiv low > IC5
56
#define VoltageHold                     PB1  // Pin 41  High = Spannung T3 halten
57
#define Display_Reset           PB2  // Pin 42
58
#define Display_A0                      PB3  // Pin 43
59
#define Display_CS                      PB4  // Pin 44
60
#define Display_SI                      PB5  // Pin  1
61
#define LED1                            PB6  // Pin  2  Low = LED1 (nicht benutzbar wegen SCL
62
#define Display_SCL                     PB7  // Pin  3
63
 
64
#define I2C_SCL                         PC0  // Pin 19  SCL
65
#define I2C_CDA                         PC1  // Pin 20  SDA
66
#define USB2FC                          PC2  // Pin 21  aktiv low > IC5
67
#define USB_BT                          PC3  // Pin 22  high = USB, Low = Bluetooth, LED2
68
#define LowBat                          PC4  // Pin 23  Low Bat Warning Lipo PKT,Input
69
#define Uart02Wi                        PC5  // Pin 24  aktiv Low > IC4
70
#define Uart02FC                        PC6  // Pin 25  aktiv Low > IC4
71
#define Summer                          PC7  // Pin 26  Low = Summer
72
 
73
#define Uart0RxD                        PD0  // Pin  9  über IC4 =Wi | SV2
74
#define Uart0TxD                        PD1  // Pin 10  über IC4 =Wi | SV2
75
#define Uart1RxD                        PD2  // Pin 11  direkt = USB, BTM, über IC5 = Wi | SV2
76
#define Uart1TxD                        PD3  // Pin 12  direkt = USB, BTM, über IC5 = Wi | SV2
77
#define PiepserTest                     PD4  // Pin 13  CTC für Piepser
78
#define Servo                           PD5  // Pin 14  PWM für Servo
79
#define Wi232_CMD                       PD6  // Pin 15  aktiv Low = Wi232 CMD
80
#define Displaybeleuchtung      PD7  // Pin 16  High = Display-LED
81
 
82
#define KEY_ENTER                       Key1
83
#define KEY_ESC                         Key2
84
#define KEY_PLUS                        Key3
85
#define KEY_MINUS                       Key4
86
 
87
 
88
 
89
//    |=     schaltet Ausgang auf HIGH
90
//    &= ~   schaltet Ausgang auf LOW
91
 
92
#define set_reset()             (PORTB |=  (1 << Display_Reset))
93
#define clr_reset()             (PORTB &= ~(1 << Display_Reset))
94
 
95
#define set_A0()                (PORTB |=  (1 << Display_A0))
96
#define clr_A0()                (PORTB &= ~(1 << Display_A0))
97
 
98
#define set_cs()                (PORTB |=  (1 << Display_CS))
99
#define clr_cs()                (PORTB &= ~(1 << Display_CS))
100
 
101
#define set_si()                (PORTB |=  (1 << Display_SI))
102
#define clr_si()                (PORTB &= ~(1 << Display_SI))
103
 
104
#define set_scl()               (PORTB |=  (1 << Display_SCL))
105
#define clr_scl()               (PORTB &= ~(1 << Display_SCL))
106
 
107
#define set_BTOn()              (PORTC &= ~(1 << USB_BT))               // Bluetooth ein
108
 
109
#define set_USBOn()             (PORTC |=  (1 << USB_BT))               // USB ein
110
 
111
#define clr_V_On()              (PORTB &= ~(1 << VoltageHold))  // Spannung mit T3 halten
112
#define set_V_On()              (PORTB |=  (1 << VoltageHold))
113
 
114
#define set_USB2FC()    (PORTC &= ~(1 << USB2FC))               // USB mit FC-Kabel verbinden
115
#define clr_USB2FC()    (PORTC |=  (1 << USB2FC))
116
 
117
#define set_USB2Wi()    (PORTB &= ~(1 << USB2Wi))               // USB mit Wi232 verbinden
118
#define clr_USB2Wi()    (PORTB |=  (1 << USB2Wi))
119
 
120
#define set_Uart02FC()  (PORTC &= ~(1 << Uart02FC))             // Uart0 mit FC-Kabel verbinden
121
#define clr_Uart02FC()  (PORTC |=  (1 << Uart02FC))
122
 
123
#define set_Uart02Wi()  (PORTC &= ~(1 << Uart02Wi))             // Uart0 mit Wi232 verbinden
124
#define clr_Uart02Wi()  (PORTC |=  (1 << Uart02Wi))
125
 
126
#define set_BEEP()              (PORTC &= ~(1 << Summer))               // Summer
127
#define clr_BEEP()              (PORTC |=  (1 << Summer))
128
 
129
#define set_WI232CMD()  (PORTD &= ~(1 << Wi232_CMD))                    // Wi232 Programmierpin
130
#define clr_WI232CMD()  (PORTD |=  (1 << Wi232_CMD))
131
 
132
 
133
 
134
void set_D_LIGHT(void);  /* Displaybeleuchtung ein*/
135
void clr_D_LIGHT(void);  /* Displaybeleuchtung aus */
136
void InitHWPorts(void);
137
 
138
 
139
#endif