Project

General

Profile

Revision 748

Added skeleton for the bay board's behavior

View differences:

main.c
1 1
#include <bayboard_lib.h>
2 2

  
3
void (*bootloader)(void) = (void*)0x3800;
4

  
5 3
int main(void)
6 4
{
7
	bayboard_init(COMM);
8

  
9
	DDRB |= _BV(PB4);
10
	PORTB |= _BV(PB4);
11

  
5
	//Any int code that runs before the default loop
6
	
7
	//Default loop
12 8
	while(1)
13 9
	{
14
		if(!(PINA&_BV(PA7)))
10
		//Check fro an XBee and if it exists become master
11
		if(checkXBee);
15 12
		{
16
			bootloader();
13
			become_master();
17 14
		}
15
		else if(packetExists) //Check for packets via I2C and act accordingly
16
		{
17
			doPacket
18
		}
18 19
	}
19
	return 0;
20
	return (0);
20 21
}
22

  
23
void become_master(void)
24
{
25
	wl_init();
26
	//Register packet
27
	//Join token ring
28
	//Become I2C Master
29
	
30
	//Main code loop
31
	while(stillHaveXBee)
32
	{
33
		//Wait for charge request
34
		//Allocate Bays
35
		//Forward packets of necessary
36
	}
37
}

Also available in: Unified diff