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*
*****************************************************************************/
// *Hardwareabhängige Definitionen und Prozeduren
// * Hardware Leiterplatte V1.3 sebseb7
// * USB,LED
#ifndef HAL_HW1_3_C_
#define HAL_HW1_3_C_
#include "cpu.h"
#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <util/delay.h>
#include "main.h"
#if defined HWVERSION1_3W || defined HWVERSION1_3
#include "lcd.h"
#include "usart.h"
#include "uart1.h"
#include "display.h"
#include "timer.h"
#include "eeprom.h"
#include "Wi232.h"
#include "twimaster.h"
void InitHWPorts(void) /* Initialisierung der Hardware für die jeweilige Leiterplattenversion */
{
// enable pull ups for the 4 keys
PORTA |= (1<<PORTA4)|(1<<PORTA5)|(1<<PORTA6)|(1<<PORTA7);
DDRD |= (1<<DDD7)|(1<<DDD6);
DDRC |= (1<<DDC2)|(1<<DDC3)|(1<<DDC6)|(1<<DDC5)|(1<<DDC7); /* Leds,Summer*/
DDRB = 0xFF;
set_LED1();
BeepTime = 500;
BeepMuster = 0x0080;
set_D_LIGHT();
clr_WI232CMD();
_delay_ms(250);
clr_LED1();
Display_on = 1;
LCD_Init (0);
USART_Init (UART_BAUD_SELECT(USART_BAUD,F_CPU));
uart1_init (UART_BAUD_SELECT(USART_BAUD,F_CPU)); /* USB*/
uart1_putc('R');
// I2C_Init(1);
Timer0_Init ();
Timer1_Init (); // pwm
Timer2_Init (); // Displaybeleuchtung
sei ();
ReadParameter ();
LCD_Init (1);
OCR2A =LCD_Helligkeit*2.55;
// InitWi232();
#ifdef HWVERSION1_3W
if (WiIsSet==false)
InitWi232(); /* wenn Wi232 nicht initialisiert ist, dann jetzt tun*/
else
{
discoverWi232(); /* Wi232 suchen*/
_delay_ms(1000);
}
#endif
}
void set_D_LIGHT(void) /* Displaybeleuchtung ein*/
{
PORTD &= ~(1<<PORTD6);
PORTC &= ~(1<<PORTC2);
PORTD &= ~(1<<PORTD7);
}
void clr_D_LIGHT(void) /* Displaybeleuchtung aus*/
{
PORTD |= (1<<PORTD6);
PORTD |= (1<<PORTD7);
PORTC |= (1<<PORTC2);
}
#endif
#endif /* HAL_HW1_3_C_ */