forked from schneider42/moodlamp-rf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacket.h
37 lines (27 loc) · 1003 Bytes
/
packet.h
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
#ifndef __PACKET_H_
#define __PACKET_H_
#include "stdint.h"
#define PACKET_BROADCAST 1
#define PACKET_REPLYDONE 2 //request for done after processing
#define PACKET_DONE 4 //done flag
#define PACKET_TIMEOUT 8
#define PACKET_MAXDATA 150
struct packet_t {
uint8_t dest;
uint8_t data[PACKET_MAXDATA];
};
#define PACKET_HEADERLEN (sizeof(struct packet_t)-PACKET_MAXDATA)
extern struct packet_t p;
//extern uint8_t localadr;
extern uint8_t broadcastadr;
//extern uint8_t serveradr;
uint8_t packet_getAddress(void);
uint8_t packet_getBroadcast(void);
uint8_t packet_isOwnAddress(struct packet_t * p);
uint8_t packet_isOwnBroadcast(struct packet_t * p);
void packet_setAddress(uint8_t address, uint8_t broadcast);
void packet_init(uint8_t address, uint8_t broadcast);
void packet_packetIn(struct packet_t * p, uint8_t interface);
void packet_tick(void);
void packet_packetOut(struct packet_t * p);
#endif