-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGroupProject.h
66 lines (54 loc) · 1.17 KB
/
GroupProject.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef GROUP_PROJECT_H
#define GROUP_PROJECT_H
#include <AM.h>
#define BULK_SIZE 10
enum {
MODE_INIT = 0,
MODE_LISTEN_ON,
MODE_LISTEN_ACK,
MODE_LISTEN_OFF,
MODE_SEND_ON,
MODE_SEND_DONE,
MODE_SEND_ACK,
MODE_SEND_OFF
};
typedef nx_struct _schedule_t {
nx_uint8_t device_id;
nx_uint8_t sendto;
nx_uint8_t listen;
nx_uint8_t listen_ack;
nx_uint8_t send;
nx_uint8_t send_done;
nx_uint8_t send_ack;
} schedule_t;
typedef nx_struct group_project_msg {
nx_am_addr_t source;
nx_uint8_t seq_no;
nx_uint16_t data;
} group_project_msg_t;
typedef nx_struct group_bulk_msg {
nx_am_addr_t source;
nx_uint8_t seq_no;
nx_uint16_t data[BULK_SIZE];
} group_bulk_msg_t;
typedef nx_struct group_bulk_ack {
nx_uint16_t nodes;
} group_bulk_ack_t;
typedef nx_struct timesync_msg {
nx_uint16_t tag;
nx_uint32_t remaining;
} timesync_msg_t;
enum {
AM_GROUP_PROJECT_MSG = 6,
AM_SYNC = 7,
AM_ACK = 8
};
typedef struct cache_entry {
am_addr_t source;
uint8_t seq_no;
} cache_entry_t;
#ifndef DATARATE
#error no data rate specified. Example: use '-DDATARATE=10' to configure a rate of 10 packets per second.
#endif
uint16_t datarate = DATARATE;
#endif