git.droids-corp.org
/
protos
/
xbee-avr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
display xbee result in decimal
[protos/xbee-avr.git]
/
rc_proto.h
diff --git
a/rc_proto.h
b/rc_proto.h
index
61b104b
..
217bb96
100644
(file)
--- a/
rc_proto.h
+++ b/
rc_proto.h
@@
-1,27
+1,56
@@
#ifndef RC_PROTO_H
#define RC_PROTO_H
#ifndef RC_PROTO_H
#define RC_PROTO_H
-#define AXIS_NUMBER 4
-
-#define RC_PROTO_TYPE_CHANNEL 0
-#define RC_PROTO_TYPE_RANGE 1
-
+/* generic header */
+struct rc_proto_hdr {
+ uint8_t type;
+} __attribute__((packed));
-/* TODO: Authenticate packet!! */
+/* send a hello message, no answer is expected from the peer */
+#define RC_PROTO_HELLO 0
+struct rc_proto_hello {
+ uint8_t type;
+ uint8_t datalen;
+ uint8_t data[];
+} __attribute__((packed));
-struct rc_proto_hdr {
+/* send an echo request, expect an echo reply from the peer */
+#define RC_PROTO_ECHO_REQ 1
+struct rc_proto_echo_req {
uint8_t type;
uint8_t type;
-};
-struct rc_proto_channel {
+ uint8_t datalen;
+ uint8_t data[];
+} __attribute__((packed));
+
+/* reply to an echo request */
+#define RC_PROTO_ECHO_ANS 2
+struct rc_proto_echo_ans {
uint8_t type;
uint8_t type;
- int16_t axis[AXIS_NUMBER];
-};
+ uint8_t datalen;
+ uint8_t data[];
+} __attribute__((packed));
-struct rc_proto_range {
+/* send a power level probe to the peer */
+#define RC_PROTO_POWER_PROBE 3
+struct rc_proto_power_probe {
uint8_t type;
uint8_t power_level;
uint8_t type;
uint8_t power_level;
+} __attribute__((packed));
+
+/* send a servo command */
+#define RC_PROTO_SERVO 4
+struct rc_proto_servo {
+ uint8_t type;
+ uint8_t mask;
+ uint8_t seq_and_pow; /* bitfield: pow are the 3 lsb, seq the 5 msb */
};
};
+/* acknowledge a servo command */
+#define RC_PROTO_ACK 5
+struct rc_proto_ack {
+ uint8_t type;
+ uint8_t seq;
+} __attribute__((packed));
void rc_proto_rx_range(int power_level);
void rc_proto_rx_range(int power_level);