Root/atusb/fw/atusb.c

Source at commit 5c5a93686b7e8985872ed451f53933f5303eba1c created 7 years 1 month ago.
By Stefan Schmidt, atusb/fw: update changelog for 0.3 firmware release
1/*
2 * fw/atusb.c - ATUSB initialization and main loop
3 *
4 * Written 2008-2011 by Werner Almesberger
5 * Copyright 2008-2011 Werner Almesberger
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, or
10 * (at your option) any later version.
11 */
12
13
14#include <stdint.h>
15
16#include <avr/io.h>
17#include <avr/sleep.h>
18#include <avr/interrupt.h>
19
20#include "usb.h"
21
22#include "board.h"
23#include "sernum.h"
24#include "spi.h"
25#include "atusb/ep0.h"
26
27
28int main(void)
29{
30    board_init();
31    board_app_init();
32    reset_rf();
33
34    user_get_descriptor = sernum_get_descr;
35
36    /* now we should be at 8 MHz */
37
38    usb_init();
39    ep0_init();
40#ifdef ATUSB
41    timer_init();
42
43    /* move interrupt vectors to 0 */
44    MCUCR = 1 << IVCE;
45    MCUCR = 0;
46#endif
47
48    sei();
49
50    while (1)
51        sleep_mode();
52}
53

Archive Download this file



interactive