summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/modules/wireless.h
blob: 19cc3d1dbe11777a911268dd1c62eb9bd6dde16a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _WIRELESS_H
#define _WIRELESS_H

#include "../../stdafx.h"

class Wireless : public IO_Module
{
public:
	Wireless()
	{
		this->parent = NULL;
		this->moduleId = 0;
	}

	Wireless(uint32 wirelessId)
	{
		this->parent = NULL;
		this->moduleId = wirelessId;

		switch(wirelessId)
		{
			case IO_WIRELESS_MAIN:
				uart_init(51); // 19200 Baud at 16MHz Atmel
				break;
			default:
				break;
		}
	}

protected:
	uint8 transmitPower;
public:
	void SetTransmitPower(uint8 newTransmitPower)
	{
		this->transmitPower = newTransmitPower;
		
		char buffer[12];
		ltoa(this->transmitPower-1, buffer, 10);
		uart_puts(buffer);
	}

	void Send(char* message)
	{
		uart_puts(message);
	}

	void Send(uint8 message)
	{
		uart_putc(message);
	}

	int16 Recieve()
	{
		return uart_getc();
	}
};

#endif