IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
Source at commit e8b68041a5f8eac8f443e22363a41f7a4aa57780 created 13 years 1 month ago. By Werner Almesberger, atusb/fw2: autonomously restore the clock output settings after an RF reset | |
---|---|
1 | #include <stdint.h> |
2 | |
3 | #include <avr/io.h> |
4 | |
5 | #define F_CPU 8000000UL |
6 | #include <util/delay.h> |
7 | |
8 | #include "freakusb.h" |
9 | |
10 | #include "board.h" |
11 | #include "spi.h" |
12 | #include "atusb/ep0.h" |
13 | |
14 | |
15 | int main(void) |
16 | { |
17 | /* We start with a 1 MHz/8 clock. Disable the prescaler. */ |
18 | |
19 | CLKPR = 1 << CLKPCE; |
20 | CLKPR = 0; |
21 | |
22 | /* set up all the outputs; default port value is 0 */ |
23 | |
24 | OUT(LED); |
25 | OUT(nRST_RF); /* resets the transceiver */ |
26 | OUT(SLP_TR); |
27 | |
28 | spi_init(); |
29 | |
30 | reset_rf(); |
31 | |
32 | /* now we should be at 8 MHz */ |
33 | |
34 | SET(LED); |
35 | _delay_ms(100); |
36 | CLR(LED); |
37 | |
38 | usb_init(); |
39 | ep0_init(); |
40 | hw_init(); |
41 | |
42 | while (1) |
43 | usb_poll(); |
44 | } |
45 |