A
download downlink.h
Language: C
License: GPL
Copyright: (C) 2003-2006 Pascal Brisset, Antoine Drouin
LOC: 53
Project Info
paparazzi
Server: Savannah NonGNU
Type: cvs
...zzi\paparazzi3\sw\airborne\
   3dmg.c
   3dmg.h
   actuators.c
   actuators.h
   adc.h
   adc_generic.c
   adc_generic.h
   ahrs.c
   ahrs.h
   ahrs_new.c
   ahrs_new.h
   anemotaxis.c
   anemotaxis.h
   ap_downlink.h
   autopilot.h
   bomb.c
   bomb.h
   cam.c
   cam.h
   cam_roll.c
   cam_roll.h
   chemo_detect.c
   chemo_detect.h
   chemotaxis.c
   chemotaxis.h
   commands.c
   commands.h
   control_grz.c
   control_grz.h
   datalink.c
   datalink.h
   dc.c
   dc.h
   discsurvey.c
   discsurvey.h
   downlink.c
   downlink.h
   dpicco.c
   dpicco.h
   enose.c
   enose.h
   estimator.c
   estimator.h
   fbw_downlink.h
   frames.h
   fw_h_ctl.c
   fw_h_ctl.h
   fw_v_ctl.c
   fw_v_ctl.h
   gps.c
   gps.h
   gps_ubx.c
   gps_ubx.h
   gyro.c
   gyro.h
   i2c.c
   i2c.h
   imu.c
   imu.h
   imu_v3.c
   imu_v3.h
   infrared.c
   infrared.h
   inter_mcu.c
   inter_mcu.h
   latlong.c
   latlong.h
   led.h
   link_imu.c
   link_imu.h
   link_mcu.c
   link_mcu.h
   main.c
   main_antenna.c
   main_ap.c
   main_ap.h
   main_demo1.c
   main_demo2.c
   main_demo3.c
   main_demo4.c
   main_demo5.c
   main_demo6.c
   main_fbw.c
   main_fbw.h
   main_grz.c
   main_imu.c
   main_motor_bench.c
   modem.h
   nav.c
   nav.h
   nav_line.c
   nav_line.h
   nav_survey_rectangle.c
   nav_survey_rectangle.h
   paparazzi.h
   point.c
   point.h
   ppm.h
   pprz_transport.c
   pprz_transport.h
   print.h
   radio_control.c
   radio_control.h
   rc_settings.c
   rc_settings.h
   setup_actuators.c
   spi.c
   spi.h
   srf08.c
   srf08.h
   sys_time.c
   sys_time.h
   test_adcs.c
   traffic_info.c
   traffic_info.h
   uart.h
   usb_serial.h
   wavecard.c
   wavecard.h
   xbee.c
   xbee.h

/*
 * Paparazzi $Id: downlink.h,v 1.25 2007/08/03 09:53:51 hecto Exp $
 *  
 * Copyright (C) 2003-2006  Pascal Brisset, Antoine Drouin
 *
 * This file is part of paparazzi.
 *
 * paparazzi is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * paparazzi is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with paparazzi; see the file COPYING.  If not, write to
 * the Free Software Foundation, 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA. 
 *
 */

/** \file downlink.h
 *  \brief Common code for AP and FBW telemetry
 *
 */

#ifndef DOWNLINK_H
#define DOWNLINK_H

#include <inttypes.h>

#if defined SITL

#ifdef SIM_UART
#include "sim_uart.h"
#include "pprz_transport.h"
#include "xbee.h"
#else /* SIM_UART */
/** Software In The Loop simulation uses IVY bus directly as the transport layer */
#include "ivy_transport.h"
#endif

#else /** SITL */
#include "pprz_transport.h"
#include "modem.h"
#include "xbee.h"
#endif /** !SITL */

#ifdef AP
/** Telemetry mode for AP process: index in the telemetry.xml file */
extern uint8_t telemetry_mode_Ap;
#endif

#ifdef FBW
/** Telemetry mode for FBW process: index in the telemetry.xml file */
extern uint8_t telemetry_mode_Fbw;
#endif

/** Counter of messages not sent because of unavailibity of the output buffer*/
extern uint8_t downlink_nb_ovrn;
extern uint16_t downlink_nb_bytes;
extern uint16_t downlink_nb_msgs;


#define __Transport(dev, _x) dev##_x
#define _Transport(dev, _x) __Transport(dev, _x)
#define Transport(_x) _Transport(DOWNLINK_TRANSPORT, _x)


/** Set of macros for generated code (messages.h) from messages.xml */
/** 2 = ac_id + msg_id */
#define DownlinkIDsSize(_x) (_x+2)
#define DownlinkSizeOf(_x) Transport(SizeOf(DownlinkIDsSize(_x)))

#define DownlinkCheckFreeSpace(_x) Transport(CheckFreeSpace((uint8_t)(_x)))

#define DownlinkPutUint8(_x) Transport(PutUint8(_x))

#define DownlinkPutInt8ByAddr(_x) Transport(PutInt8ByAddr(_x))
#define DownlinkPutUint8ByAddr(_x) Transport(PutUint8ByAddr(_x))
#define DownlinkPutInt16ByAddr(_x) Transport(PutInt16ByAddr(_x))
#define DownlinkPutUint16ByAddr(_x) Transport(PutUint16ByAddr(_x))
#define DownlinkPutInt32ByAddr(_x) Transport(PutInt32ByAddr(_x))
#define DownlinkPutUint32ByAddr(_x) Transport(PutUint32ByAddr(_x))
#define DownlinkPutFloatByAddr(_x) Transport(PutFloatByAddr(_x))

#define DownlinkPutFloatArray(_n, _x) Transport(PutFloatArray(_n, _x))
#define DownlinkPutInt16Array(_n, _x) Transport(PutInt16Array(_n, _x))
#define DownlinkPutUint16Array(_n, _x) Transport(PutUint16Array(_n, _x))
#define DownlinkPutUint8Array(_n, _x) Transport(PutUint8Array(_n, _x))

#define DownlinkOverrun() downlink_nb_ovrn++;
#define DownlinkCountBytes(_n) downlink_nb_bytes += _n;

#define DownlinkStartMessage(_name, msg_id, payload_len) { \
  downlink_nb_msgs++; \
  Transport(Header(DownlinkIDsSize(payload_len))); \
  Transport(PutUint8(AC_ID)); \
  Transport(PutNamedUint8(_name, msg_id)); \
}

#define DownlinkEndMessage() Transport(Trailer())

#endif /* DOWNLINK_H */

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us