Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2136 | - | 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 | //# HISTORY HAL_HW3_9.h |
||
36 | //# |
||
37 | //# 01.04.2014 OG |
||
38 | //# - chg: PCB_WiFlyPatch umbenannt zu PCB_SV2RxTxPatch |
||
39 | //# |
||
40 | //# 26.06.2013 Cebra |
||
41 | //# - add: defines für WyFlypatch Port C0 + C1 |
||
42 | //# |
||
43 | //# 17.05.2013 OG |
||
44 | //# - add: defines: KEY_ENTER_LONG, KEY_ESC_LONG, KEY_PLUS_LONG, KEY_MINUS_LONG |
||
45 | //############################################################################ |
||
46 | |||
47 | |||
48 | #ifndef HAL_HW3_9_H_ |
||
49 | #define HAL_HW3_9_H_ |
||
50 | |||
51 | |||
52 | |||
53 | //#define PIEPSER_NERVT // Summer zu Testzwecken ganz Ausschalten |
||
54 | |||
55 | #define PKT39m 1 |
||
56 | #define PKT39x 2 |
||
57 | |||
58 | #define USB 1 |
||
59 | #define Bluetooth 2 |
||
60 | #define Wlan 3 |
||
61 | |||
62 | |||
63 | |||
64 | // Hardware 3.9 Portbelegung |
||
65 | #define KEY_PIN PINA // Port A als Input |
||
66 | |||
67 | #define Touch0 PA0 // Pin 37 |
||
68 | #define Touch1 PA1 // Pin 36 |
||
69 | #define Touch2 PA2 // Pin 35 |
||
70 | #define Touch3 PA3 // Pin 34 |
||
71 | #define KEY_EXT PINA3 // MartinR |
||
72 | |||
73 | #define Key1 PA4 // Pin 33 |
||
74 | #define Key2 PA5 // Pin 32 |
||
75 | #define Key3 PA6 // Pin 31 |
||
76 | #define Key4 PA7 // Pin 30 |
||
77 | |||
78 | #define USB2Wi PB0 // Pin 40 aktiv low > IC5 |
||
79 | #define VoltageHold PB1 // Pin 41 High = Spannung T3 halten |
||
80 | #define Display_Reset PB2 // Pin 42 |
||
81 | #define Display_A0 PB3 // Pin 43 |
||
82 | #define Display_CS PB4 // Pin 44 |
||
83 | #define Display_SI PB5 // Pin 1 |
||
84 | #define LED1 PB6 // Pin 2 Low = LED1 (nicht benutzbar wegen SCL |
||
85 | #define Display_SCL PB7 // Pin 3 |
||
86 | |||
87 | #define I2C_SCL PC0 // Pin 19 SCL |
||
88 | #define I2C_CDA PC1 // Pin 20 SDA |
||
89 | |||
90 | #define BT_Reset PC0 // Pin 19 Reseteingang BTM222 / WiyFlypatch |
||
91 | #define WiFly_Reset PC1 // Pin 20 Reseteingang WyFly / WiyFlypatch |
||
92 | |||
93 | #define USB2FC PC2 // Pin 21 aktiv low > IC5 |
||
94 | #define USB_BT PC3 // Pin 22 high = USB, Low = Bluetooth, LED2 |
||
95 | |||
96 | #define USB_Reset PC3 // Pin 22 Reseteingang USB FT232 / WiFlypatch |
||
97 | |||
98 | #define LowBat PC4 // Pin 23 Low Bat Warning Lipo PKT,Input |
||
99 | #define Uart02Wi PC5 // Pin 24 aktiv Low > IC4 |
||
100 | #define Uart02FC PC6 // Pin 25 aktiv Low > IC4 |
||
101 | #define Summer PC7 // Pin 26 Low = Summer |
||
102 | #define DisplaybeleuchtungV2 PC7 // Pin 26 High = Display-LED PCB 3.9x |
||
103 | |||
104 | #define Uart0RxD PD0 // Pin 9 über IC4 =Wi | SV2 |
||
105 | #define Uart0TxD PD1 // Pin 10 über IC4 =Wi | SV2 |
||
106 | #define Uart1RxD PD2 // Pin 11 direkt = USB, BTM, über IC5 = Wi | SV2 |
||
107 | #define Uart1TxD PD3 // Pin 12 direkt = USB, BTM, über IC5 = Wi | SV2 |
||
108 | #define SERVO2 PD4 // Pin 13 PWM Servo 2 |
||
109 | #define SERVO1 PD5 // Pin 14 PWM Servo 1 |
||
110 | #define Wi232_CMD PD6 // Pin 15 aktiv Low = Wi232 CMD |
||
111 | #define Displaybeleuchtung PD7 // Pin 16 High = Display-LED PCB 3.9m |
||
112 | #define SummerV2 PD7 // Pin 16 Low = Summer, PCB 3.9x |
||
113 | |||
114 | #define KEY_ENTER Key1 |
||
115 | #define KEY_ESC Key2 |
||
116 | #define KEY_PLUS Key3 |
||
117 | #define KEY_MINUS Key4 |
||
118 | |||
119 | #define KEY_NONE 0 // keine Taste (menuctrl) |
||
120 | |||
121 | #define KEY_ENTER_LONG KEY_ENTER+100 // for long press keys used in scrollbox & menuctrl |
||
122 | #define KEY_ESC_LONG KEY_ESC+100 |
||
123 | #define KEY_PLUS_LONG KEY_PLUS+100 |
||
124 | #define KEY_MINUS_LONG KEY_MINUS+100 |
||
125 | |||
126 | |||
127 | // |= schaltet Ausgang auf HIGH |
||
128 | // &= ~ schaltet Ausgang auf LOW |
||
129 | |||
130 | #define set_reset() (PORTB |= (1 << Display_Reset)) |
||
131 | #define clr_reset() (PORTB &= ~(1 << Display_Reset)) |
||
132 | |||
133 | #define set_A0() (PORTB |= (1 << Display_A0)) |
||
134 | #define clr_A0() (PORTB &= ~(1 << Display_A0)) |
||
135 | |||
136 | #define set_cs() (PORTB |= (1 << Display_CS)) |
||
137 | #define clr_cs() (PORTB &= ~(1 << Display_CS)) |
||
138 | |||
139 | #define set_si() (PORTB |= (1 << Display_SI)) |
||
140 | #define clr_si() (PORTB &= ~(1 << Display_SI)) |
||
141 | |||
142 | #define set_scl() (PORTB |= (1 << Display_SCL)) |
||
143 | #define clr_scl() (PORTB &= ~(1 << Display_SCL)) |
||
144 | |||
145 | #define _BTOn() (PORTC &= ~(1 << USB_BT)) // Bluetooth ein |
||
146 | |||
147 | #define set_USBOn() (PORTC |= (1 << USB_Reset)) // USB ein |
||
148 | #define clr_USBOn() (PORTC &= ~(1 << USB_Reset)) // USB aus |
||
149 | |||
150 | #define set_BTM222On() (PORTC |= (1 << BT_Reset)) // BT ein |
||
151 | #define clr_BTM222On() (PORTC &= ~(1 << BT_Reset)) // BT aus |
||
152 | |||
153 | #define set_WiFlyOn() (PORTC |= (1 << WiFly_Reset)) // WiFly ein |
||
154 | #define clr_WiFlyOn() (PORTC &= ~(1 << WiFly_Reset)) // WiFly aus |
||
155 | |||
156 | #define clr_V_On() (PORTB &= ~(1 << VoltageHold)) // Spannung mit T3 halten |
||
157 | #define set_V_On() (PORTB |= (1 << VoltageHold)) |
||
158 | |||
159 | #define set_USB2FC() (PORTC &= ~(1 << USB2FC)) // USB mit FC-Kabel verbinden |
||
160 | #define clr_USB2FC() (PORTC |= (1 << USB2FC)) |
||
161 | |||
162 | #define set_USB2Wi() (PORTB &= ~(1 << USB2Wi)) // USB mit Wi232 verbinden |
||
163 | #define clr_USB2Wi() (PORTB |= (1 << USB2Wi)) |
||
164 | |||
165 | #define set_Uart02FC() (PORTC &= ~(1 << Uart02FC)) // Uart0 mit FC-Kabel verbinden |
||
166 | #define clr_Uart02FC() (PORTC |= (1 << Uart02FC)) |
||
167 | |||
168 | #define set_Uart02Wi() (PORTC &= ~(1 << Uart02Wi)) // Uart0 mit Wi232 verbinden |
||
169 | #define clr_Uart02Wi() (PORTC |= (1 << Uart02Wi)) |
||
170 | |||
171 | |||
172 | #define set_DISPLAYLIGHT() (PORTD &= ~(1 << Displaybeleuchtung)) // Displaybeleuchtung PCB3.9m |
||
173 | #define clr_DISPLAYLIGHT() (PORTD |= (1 << Displaybeleuchtung)) |
||
174 | #define set_DISPLAYLIGHTV2() (PORTC &= ~(1 << DisplaybeleuchtungV2)) // Displaybeleuchtung PCB3.9x |
||
175 | #define clr_DISPLAYLIGHTV2() (PORTC |= (1 << DisplaybeleuchtungV2)) |
||
176 | |||
177 | #define set_WI232CMD() (PORTD &= ~(1 << Wi232_CMD)) // Wi232 Programmierpin |
||
178 | #define clr_WI232CMD() (PORTD |= (1 << Wi232_CMD)) |
||
179 | |||
180 | |||
181 | |||
182 | void set_D_LIGHT(void); /* Displaybeleuchtung ein*/ |
||
183 | void clr_D_LIGHT(void); /* Displaybeleuchtung aus */ |
||
184 | void set_BEEP(void); /* Beeper ein*/ |
||
185 | void clr_BEEP(void); /* Beeper aus*/ |
||
186 | void InitHWPorts(void); |
||
187 | void set_BTOn(void); /* Bluetooth einschalten*/ |
||
188 | void set_BTOff(void); /* Bluetooth einschalten*/ |
||
189 | void set_Modul_On(uint8_t Modul); |
||
190 | extern volatile uint8_t PCB_Version; |
||
191 | extern volatile uint8_t PCB_SV2RxTxPatch; |
||
192 | |||
193 | |||
194 | #endif |