X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=rc_proto.c;h=56e8ad60333b398e8f0c3637082ab0e510450d2d;hp=fe5c928bcc048ea45e2847e48b85a4d347a3b6c8;hb=4d9670d6245cc381313a3ff41dd80f6596a266c8;hpb=d590ebe19bfe60a544717606a0ff2b348cc32229 diff --git a/rc_proto.c b/rc_proto.c index fe5c928..56e8ad6 100644 --- a/rc_proto.c +++ b/rc_proto.c @@ -25,6 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include + #include #include @@ -32,8 +34,6 @@ #include -#include -#include #include #include #include @@ -41,6 +41,7 @@ #include "callout.h" #include "rc_proto.h" +#include "xbee_user.h" #include "main.h" /* */ @@ -76,6 +77,25 @@ void rc_proto_rx_power_probe(int power_level) xbeeapp_send_atcmd("DB", NULL, 0, 0, update_power_level, NULL); } +/* send a hello message */ +int8_t rc_proto_send_hello(uint64_t addr, void *data, uint8_t data_len) +{ + struct rc_proto_echo_req hdr; + struct xbee_msg msg; + + hdr.type = RC_PROTO_HELLO; + hdr.datalen = data_len; + + msg.iovlen = 2; + msg.iov[0].buf = &hdr; + msg.iov[0].len = sizeof(hdr); + msg.iov[1].buf = data; + msg.iov[1].len = data_len; + + return xbeeapp_send_msg(addr, &msg, 1); +} + + #if 0 #define N_SERVO 6 #define SERVO_NBITS 10