Project

General

Profile

Revision 967

now it will work

View differences:

trunk/code/projects/template/main.c
1 1
#include <dragonfly_lib.h>
2
#include <wireless.h>
3
#include <encoders.h>
2 4

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

  
8
void packet_receive(char type, int source, unsigned char* packet, int length);
9

  
3 10
int main(void)
4 11
{
12
	/* initialize components, set wireless channel */
5 13
	dragonfly_init(ALL_ON);
6
    double d0 = 0x889a3f23;
7
    char buf[100];
8
    sprintf(buf, "int:%d, float:%d, double:%d\n", sizeof(int), sizeof(float), sizeof(double));
9
    usb_puts(buf);
10
    return 1;
14
	wl_init();
15
	wl_set_channel(CHAN);
16
	orb_enable();
17

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

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

  
25
		/* send a packet with no usefull info for testing */
26
		wl_send_global_packet(TEST, TEST, NULL, 0, 0);
27
	}
28

  
29
	wl_terminate();
30

  
31
	return 0;
11 32
}
12 33

  
34
void packet_receive(char type, int source, unsigned char* packet, int length)
35
{
36
	orb_set_color(type);
37
}
13 38

  
trunk/code/projects/template/Makefile
4 4

  
5 5
# Relative path to the root directory (containing lib directory)
6 6
ifndef COLONYROOT
7
COLONYROOT = ../../..
7
COLONYROOT = ../../../..
8 8
endif
9 9

  
10 10
# Target file name (without extension).
11 11
TARGET = template
12 12

  
13 13
# Uncomment this to use the wireless library
14
# USE_WIRELESS = 1
14
USE_WIRELESS = 1
15 15

  
16 16
# com1 = serial port. Use lpt1 to connect to parallel port.
17 17
AVRDUDE_PORT = /dev/ttyUSB0

Also available in: Unified diff