Project

General

Profile

Revision 1380

Added by Chris Mar over 14 years ago

fixed doxygen problems in wireless library, added new docs

View differences:

main.c
1 1
#include <dragonfly_lib.h>
2 2
#include <wireless.h>
3
#include <encoders.h>
3
#include <wl_basic.h>
4 4

  
5 5
#define CHAN 0xE	/* channel to use for wireless communication */
6
#define TEST 1		/* group and type numbers for sending test packets */
6
#define WL_BASIC_GROUP 8		/* group and type numbers for sending test packets */
7 7

  
8 8
void packet_receive(char type, int source, unsigned char* packet, int length);
9
PacketGroupHandler wl_basic_group_handler = {WL_BASIC_GROUP, NULL, NULL, &packet_receive, NULL};
9 10

  
10 11
int main(void)
11 12
{
12 13
	/* initialize components, set wireless channel */
13 14
	dragonfly_init(ALL_ON);
14
	wl_init();
15
	wl_basic_init(&packet_receive);
15 16
	wl_set_channel(CHAN);
16
	orb_enable();
17 17

  
18 18
	/* set up a packet group (or something) to receive packets */
19
	wl_register_packet_group(&packet_receive);
19
	//wl_register_packet_group(&wl_basic_group_handler);
20 20

  
21 21
	while (1)
22 22
	{
23 23
		wl_do();
24 24

  
25
		/* send a packet with no usefull info for testing */
26
		wl_send_global_packet(TEST, TEST, NULL, 0, 0);
25
		/* send a packet with no useful info for testing */
26
        if (button1_click() ) {
27
		    wl_basic_send_global_packet(1, NULL, 0);
28
        }
29
        if (button2_click() ) {
30
		    wl_basic_send_global_packet(2, NULL, 0);
31
        }
27 32
	}
28 33

  
29 34
	wl_terminate();
......
33 38

  
34 39
void packet_receive(char type, int source, unsigned char* packet, int length)
35 40
{
36
	orb_set_color(type);
41
	if ( type == 1 ) {
42
        orb_set_color(RED);
43
    }
44
    else if ( type == 2 ) {
45
        orb_set_color(BLUE);
46
    }
37 47
}
38 48

  

Also available in: Unified diff