Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1734 | - | 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 V1.3 sebseb7 |
||
37 | // * USB,LED |
||
38 | |||
39 | |||
40 | #ifndef HAL_HW1_3_C_ |
||
41 | #define HAL_HW1_3_C_ |
||
42 | |||
43 | |||
44 | |||
45 | #include "cpu.h" |
||
46 | #include <inttypes.h> |
||
47 | #include <avr/io.h> |
||
48 | #include <avr/interrupt.h> |
||
49 | #include <avr/pgmspace.h> |
||
50 | #include <avr/eeprom.h> |
||
51 | #include <util/delay.h> |
||
52 | #include "main.h" |
||
53 | |||
54 | #if defined HWVERSION1_3W || defined HWVERSION1_3 |
||
55 | |||
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 | void InitHWPorts(void) /* Initialisierung der Hardware für die jeweilige Leiterplattenversion */ |
||
69 | |||
70 | { |
||
71 | |||
72 | // enable pull ups for the 4 keys |
||
73 | PORTA |= (1<<PORTA4)|(1<<PORTA5)|(1<<PORTA6)|(1<<PORTA7); |
||
74 | |||
75 | DDRD |= (1<<DDD7)|(1<<DDD6); |
||
76 | DDRC |= (1<<DDC2)|(1<<DDC3)|(1<<DDC6)|(1<<DDC5)|(1<<DDC7); /* Leds,Summer*/ |
||
77 | |||
78 | DDRB = 0xFF; |
||
79 | set_LED1(); |
||
80 | |||
81 | BeepTime = 500; |
||
82 | BeepMuster = 0x0080; |
||
83 | |||
84 | set_D_LIGHT(); |
||
85 | clr_WI232CMD(); |
||
86 | _delay_ms(250); |
||
87 | |||
88 | clr_LED1(); |
||
89 | |||
90 | |||
91 | Display_on = 1; |
||
92 | |||
93 | LCD_Init (0); |
||
94 | USART_Init (UART_BAUD_SELECT(USART_BAUD,F_CPU)); |
||
95 | |||
96 | uart1_init (UART_BAUD_SELECT(USART_BAUD,F_CPU)); /* USB*/ |
||
97 | uart1_putc('R'); |
||
98 | // I2C_Init(1); |
||
99 | |||
100 | Timer0_Init (); |
||
101 | Timer1_Init (); // pwm |
||
102 | Timer2_Init (); // Displaybeleuchtung |
||
103 | sei (); |
||
104 | |||
105 | ReadParameter (); |
||
106 | LCD_Init (1); |
||
107 | OCR2A =LCD_Helligkeit*2.55; |
||
108 | // InitWi232(); |
||
109 | #ifdef HWVERSION1_3W |
||
110 | if (WiIsSet==false) |
||
111 | InitWi232(); /* wenn Wi232 nicht initialisiert ist, dann jetzt tun*/ |
||
112 | else |
||
113 | { |
||
114 | discoverWi232(); /* Wi232 suchen*/ |
||
115 | _delay_ms(1000); |
||
116 | } |
||
117 | #endif |
||
118 | |||
119 | } |
||
120 | |||
121 | void set_D_LIGHT(void) /* Displaybeleuchtung ein*/ |
||
122 | { |
||
123 | PORTD &= ~(1<<PORTD6); |
||
124 | PORTC &= ~(1<<PORTC2); |
||
125 | PORTD &= ~(1<<PORTD7); |
||
126 | } |
||
127 | |||
128 | void clr_D_LIGHT(void) /* Displaybeleuchtung aus*/ |
||
129 | { |
||
130 | PORTD |= (1<<PORTD6); |
||
131 | PORTD |= (1<<PORTD7); |
||
132 | PORTC |= (1<<PORTC2); |
||
133 | } |
||
134 | |||
135 | |||
136 | #endif |
||
137 | #endif /* HAL_HW1_3_C_ */ |