root / branches / encoders / code / projects / template / main.c @ 446
History | View | Annotate | Download (404 Bytes)
1 | 16 | bcoltin | #include <dragonfly_lib.h> |
---|---|---|---|
2 | 367 | kwoo | #include "spi.h" |
3 | 16 | bcoltin | |
4 | 446 | bpoole | #define MODE 0 |
5 | 257 | ayeager | |
6 | 367 | kwoo | void recv_func(char c) { |
7 | usb_puts("Received: ");
|
||
8 | usb_putc(c); |
||
9 | usb_puts("\r\n");
|
||
10 | return;
|
||
11 | 193 | ayeager | } |
12 | |||
13 | |||
14 | |||
15 | 16 | bcoltin | int main(void) |
16 | { |
||
17 | dragonfly_init(ALL_ON); |
||
18 | 367 | kwoo | spi_init(MODE, recv_func); |
19 | usb_puts("Init done\r\n");
|
||
20 | while(1) { |
||
21 | //usb_puts("loop\r\n");
|
||
22 | if (MODE) {
|
||
23 | 446 | bpoole | spi_master_recv_on(); |
24 | }else {
|
||
25 | SPDR = 'b';
|
||
26 | // delay_ms(10);
|
||
27 | 257 | ayeager | } |
28 | 367 | kwoo | |
29 | } |
||
30 | 257 | ayeager | |
31 | 16 | bcoltin | return 0; |
32 | 193 | ayeager | |
33 | 16 | bcoltin | } |