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 *
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net *
* Copyright (C) 2011 Harald Bongartz *
* *
* 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/ *
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
*****************************************************************************/
#ifndef HAL_HW3_9_H_
#define HAL_HW3_9_H_
//#define PIEPSER_NERVT // Summer zu Testzwecken ganz Ausschalten
// Hardware 3.9 Portbelegung
#define KEY_PIN PINA // Port A als Input
// MartinR: von PA.. auf PINA.. geändert...
#define Touch0 PINA0 // Pin 37
#define Touch1 PINA1 // Pin 36
#define Touch2 PINA2 // Pin 35
#define Touch3 PINA3 // Pin 34
#define Key1 PINA4 // Pin 33 // MartinR: von PA.. auf PINA.. geändert
#define Key2 PINA5 // Pin 32 // MartinR: von PA.. auf PINA.. geändert
#define Key3 PINA6 // Pin 31 // MartinR: von PA.. auf PINA.. geändert
#define Key4 PINA7 // Pin 30 // MartinR: von PA.. auf PINA.. geändert
#define USB2Wi PINB0 // Pin 40 aktiv low > IC5
#define VoltageHold PINB1 // Pin 41 High = Spannung T3 halten
#define Display_Reset PINB2 // Pin 42
#define Display_A0 PINB3 // Pin 43
#define Display_CS PINB4 // Pin 44
#define Display_SI PINB5 // Pin 1
#define LED1 PINB6 // Pin 2 Low = LED1 (nicht benutzbar wegen SCL
#define Display_SCL PINB7 // Pin 3
#define I2C_SCL PINC0 // Pin 19 SCL
#define I2C_CDA PINC1 // Pin 20 SDA
#define USB2FC PINC2 // Pin 21 aktiv low > IC5
#define USB_BT PINC3 // Pin 22 high = USB, Low = Bluetooth, LED2
#define LowBat PINC4 // Pin 23 Low Bat Warning Lipo PKT,Input
#define Uart02Wi PINC5 // Pin 24 aktiv Low > IC4
#define Uart02FC PINC6 // Pin 25 aktiv Low > IC4
#define Summer PINC7 // Pin 26 Low = Summer
#define Uart0RxD PIND0 // Pin 9 über IC4 =Wi | SV2
#define Uart0TxD PIND1 // Pin 10 über IC4 =Wi | SV2
#define Uart1RxD PIND2 // Pin 11 direkt = USB, BTM, über IC5 = Wi | SV2
#define Uart1TxD PIND3 // Pin 12 direkt = USB, BTM, über IC5 = Wi | SV2
#define PiepserTest PIND4 // Pin 13 CTC für Piepser
#define Servo PIND5 // Pin 14 PWM für Servo
#define Wi232_CMD PIND6 // Pin 15 aktiv Low = Wi232 CMD
#define Displaybeleuchtung PIND7 // Pin 16 High = Display-LED
#define KEY_ENTER Key1
#define KEY_ESC Key2
#define KEY_PLUS Key3
#define KEY_MINUS Key4
#define KEY_EXT PINA3 // MartinR
// |= schaltet Ausgang auf HIGH
// &= ~ schaltet Ausgang auf LOW
#define set_reset() (PORTB |= (1 << Display_Reset))
#define clr_reset() (PORTB &= ~(1 << Display_Reset))
#define set_A0() (PORTB |= (1 << Display_A0))
#define clr_A0() (PORTB &= ~(1 << Display_A0))
#define set_cs() (PORTB |= (1 << Display_CS))
#define clr_cs() (PORTB &= ~(1 << Display_CS))
#define set_si() (PORTB |= (1 << Display_SI))
#define clr_si() (PORTB &= ~(1 << Display_SI))
#define set_scl() (PORTB |= (1 << Display_SCL))
#define clr_scl() (PORTB &= ~(1 << Display_SCL))
#define _BTOn() (PORTC &= ~(1 << USB_BT)) // Bluetooth ein
#define set_USBOn() (PORTC |= (1 << USB_BT)) // USB ein
#define clr_V_On() (PORTB &= ~(1 << VoltageHold)) // Spannung mit T3 halten
#define set_V_On() (PORTB |= (1 << VoltageHold))
#define set_USB2FC() (PORTC &= ~(1 << USB2FC)) // USB mit FC-Kabel verbinden
#define clr_USB2FC() (PORTC |= (1 << USB2FC))
#define set_USB2Wi() (PORTB &= ~(1 << USB2Wi)) // USB mit Wi232 verbinden
#define clr_USB2Wi() (PORTB |= (1 << USB2Wi))
#define set_Uart02FC() (PORTC &= ~(1 << Uart02FC)) // Uart0 mit FC-Kabel verbinden
#define clr_Uart02FC() (PORTC |= (1 << Uart02FC))
#define set_Uart02Wi() (PORTC &= ~(1 << Uart02Wi)) // Uart0 mit Wi232 verbinden
#define clr_Uart02Wi() (PORTC |= (1 << Uart02Wi))
#define set_BEEP() (PORTC &= ~(1 << Summer)) // Summer
#define clr_BEEP() (PORTC |= (1 << Summer))
#define set_WI232CMD() (PORTD &= ~(1 << Wi232_CMD)) // Wi232 Programmierpin
#define clr_WI232CMD() (PORTD |= (1 << Wi232_CMD))
void set_D_LIGHT(void); /* Displaybeleuchtung ein*/
void clr_D_LIGHT(void); /* Displaybeleuchtung aus */
void InitHWPorts(void);
void set_BTOn(void); /* Bluetooth einschalten*/
void set_BTOff(void); /* Bluetooth einschalten*/
#endif