+/* send a gps_pos message: no answer expected */
+int8_t rc_proto_send_gps_pos(uint64_t addr, int8_t power)
+{
+ struct rc_proto_gps_pos gps_msg;
+ struct xbee_msg msg;
+ uint8_t prio;
+ int8_t ret;
+ uint8_t irq_flags;
+
+ gps_msg.type = RC_PROTO_GPS_POS;
+
+ IRQ_LOCK(irq_flags);
+ gps_msg.valid = !!(imuboard_status.flags & I2C_IMUBOARD_STATUS_GPS_OK);
+ gps_msg.latitude = imuboard_status.latitude;
+ gps_msg.longitude = imuboard_status.longitude;
+ gps_msg.altitude = imuboard_status.altitude;
+ IRQ_UNLOCK(irq_flags);
+
+ msg.iovlen = 1;
+ msg.iov[0].buf = &gps_msg;
+ msg.iov[0].len = sizeof(gps_msg);
+
+ /* set power level */
+ if (power != -1)
+ xbeeapp_send_atcmd("PL", &power, sizeof(power), NULL, NULL);
+
+ /* we also need to lock callout to increment stats */
+ prio = callout_mgr_set_prio(&xbeeboard.intr_cm, XBEE_PRIO);
+ stats.gps_pos_tx++;
+ ret = xbeeapp_send_msg(addr, &msg, NULL, NULL);
+ callout_mgr_restore_prio(&xbeeboard.intr_cm, prio);
+
+ return ret;
+}
+
+/* send a imu_pos message: no answer expected */
+int8_t rc_proto_send_imu_pos(uint64_t addr, int8_t power)
+{
+ struct rc_proto_imu_pos imu_msg;
+ struct xbee_msg msg;
+ uint8_t prio;
+ int8_t ret;
+ uint8_t irq_flags;
+
+ imu_msg.type = RC_PROTO_IMU_POS;
+
+ IRQ_LOCK(irq_flags);
+ imu_msg.valid = !!(imuboard_status.flags & I2C_IMUBOARD_STATUS_IMU_OK);
+ imu_msg.roll = imuboard_status.roll;
+ imu_msg.pitch = imuboard_status.pitch;
+ imu_msg.yaw = imuboard_status.yaw;
+ IRQ_UNLOCK(irq_flags);
+
+ msg.iovlen = 1;
+ msg.iov[0].buf = &imu_msg;
+ msg.iov[0].len = sizeof(imu_msg);
+
+ /* set power level */
+ if (power != -1)
+ xbeeapp_send_atcmd("PL", &power, sizeof(power), NULL, NULL);
+
+ /* we also need to lock callout to increment stats */
+ prio = callout_mgr_set_prio(&xbeeboard.intr_cm, XBEE_PRIO);
+ stats.imu_pos_tx++;
+ ret = xbeeapp_send_msg(addr, &msg, NULL, NULL);
+ callout_mgr_restore_prio(&xbeeboard.intr_cm, prio);
+
+ return ret;
+}
+
+
+
+void rc_proto_set_mode(uint16_t flags)