Revision 783
Contains a test case that lets you specify the pattern of LEDs on the BOM1.5 over serial
branches/rbom/code/projects/template/main.c | ||
---|---|---|
1 | 1 |
#include <dragonfly_lib.h> |
2 | 2 |
|
3 | 3 |
int main(void) { |
4 |
dragonfly_init(ALL_ON|BOM_15);
|
|
4 |
dragonfly_init(ALL_ON); |
|
5 | 5 |
orb_init(); |
6 | 6 |
orb_enable(); |
7 | 7 |
bom_on(); |
8 |
char state = 0; |
|
8 |
orb1_set_color(RED); |
|
9 |
char l0, l1, h0, h1, on; |
|
10 |
int mask; |
|
9 | 11 |
while(1) |
10 | 12 |
{ |
11 |
if(button1_click())
|
|
12 |
state ^= 1;
|
|
13 |
if(button2_click())
|
|
14 |
state ^= 2;
|
|
15 |
|
|
16 |
if(state&1)
|
|
17 |
{
|
|
18 |
orb1_set_color(RED);
|
|
19 |
digital_output(_PIN_A1, 1);
|
|
20 |
|
|
21 |
}
|
|
13 |
l0 = usb_getc()&0xf;
|
|
14 |
l1 = usb_getc()&0xf;
|
|
15 |
h0 = usb_getc()&0xf;
|
|
16 |
h1 = usb_getc()&0xf;
|
|
17 |
on = usb_getc(); |
|
18 |
mask = l0|(l1<<4)|(h0<<8)|(h1<<12);
|
|
19 |
usb_puti(mask);
|
|
20 |
usb_putc('\n');
|
|
21 |
bom_set_leds(mask);
|
|
22 |
if(on == 'o') |
|
23 |
bom_on();
|
|
22 | 24 |
else |
23 |
{ |
|
24 |
orb1_set_color(BLUE); |
|
25 |
digital_output(_PIN_A1, 0); |
|
26 |
} |
|
27 |
if(state&2) |
|
28 |
{ |
|
29 |
orb2_set_color(GREEN); |
|
30 |
digital_output(_PIN_A0, 1); |
|
31 |
} |
|
32 |
else |
|
33 |
{ |
|
34 |
orb2_set_color(BLUE); |
|
35 |
digital_output(_PIN_A0, 0); |
|
36 |
} |
|
25 |
bom_off(); |
|
37 | 26 |
} |
38 | 27 |
return 0; |
39 | 28 |
} |
branches/rbom/code/projects/template/Makefile | ||
---|---|---|
14 | 14 |
# USE_WIRELESS = 1 |
15 | 15 |
|
16 | 16 |
# com1 = serial port. Use lpt1 to connect to parallel port. |
17 |
AVRDUDE_PORT = com6
|
|
17 |
AVRDUDE_PORT = com5
|
|
18 | 18 |
# |
19 | 19 |
# |
20 | 20 |
################################### |
Also available in: Unified diff