]> git.zerfleddert.de Git - fnordlicht-mini/blob - firmware/fnordlicht-controller/fcontrol.c
reference firmware
[fnordlicht-mini] / firmware / fnordlicht-controller / fcontrol.c
1 /* vim:ts=4 sts=4 et tw=80
2 *
3 * fnordlicht firmware
4 *
5 * for additional information please
6 * see http://lochraster.org/fnordlichtmini
7 *
8 * (c) by Alexander Neumann <alexander@bumpern.de>
9 * Lars Noschinski <lars@public.noschinski.de>
10 *
11 * This program is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 3 as published by
13 * the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * more details.
19 *
20 * You should have received a copy of the GNU General Public License along with
21 * this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 /* includes */
25 #include "globals.h"
26 #include "../common/io.h"
27
28 #include <stdint.h>
29 #include <avr/interrupt.h>
30 #include <avr/pgmspace.h>
31 #include <avr/wdt.h>
32
33 #include "../common/common.h"
34 #include "usb.h"
35 #include "timer.h"
36 #include "uart.h"
37 #include "ui.h"
38 #include "ir.h"
39
40 /* NEVER CALL DIRECTLY! */
41 void disable_watchdog(void) \
42 __attribute__((naked)) \
43 __attribute__((section(".init3")));
44 void disable_watchdog(void)
45 {
46 MCUSR = 0;
47 wdt_disable();
48 }
49
50 /** main function
51 */
52 int main(void)
53 {
54 usb_init();
55 timer_init();
56 uart_init();
57 ui_init();
58 ir_init();
59 ir_set_mode(IR_RECEIVE);
60
61 /* enable interrupts globally */
62 sei();
63
64 usb_enable();
65
66 ui_blink(0x03, 0);
67
68 while (1) {
69 usb_poll();
70 ui_poll();
71 ir_poll();
72 }
73 }
Impressum, Datenschutz