/**
 ******************************************************************************
 * @addtogroup UAVObjects OpenPilot UAVObjects
 * @{ 
 * @addtogroup AttitudeRaw AttitudeRaw 
 * @brief The raw attitude sensor data from @ref AHRSCommsModule.  Not always updated.
 *
 * Autogenerated files and functions for AttitudeRaw Object
 
 * @{ 
 *
 * @file       attituderaw.h
 * @author     The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
 * @brief      Implementation of the AttitudeRaw object. This file has been 
 *             automatically generated by the UAVObjectGenerator.
 * 
 * @note       Object definition file: attituderaw.xml. 
 *             This is an automatically generated file.
 *             DO NOT modify manually.
 *
 * @see        The GNU Public License (GPL) Version 3
 *
 *****************************************************************************/
/*
 * This program 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#ifndef ATTITUDERAW_H
#define ATTITUDERAW_H

// Object constants
#define ATTITUDERAW_OBJID 1323193976U
#define ATTITUDERAW_NAME "AttitudeRaw"
#define ATTITUDERAW_METANAME "AttitudeRawMeta"
#define ATTITUDERAW_ISSINGLEINST 1
#define ATTITUDERAW_ISSETTINGS 0
#define ATTITUDERAW_NUMBYTES sizeof(AttitudeRawData)

// Object access macros
/**
 * @function AttitudeRawGet(dataOut)
 * @brief Populate a AttitudeRawData object
 * @param[out] dataOut 
 */
#define AttitudeRawGet(dataOut) UAVObjGetData(AttitudeRawHandle(), dataOut)
#define AttitudeRawSet(dataIn) UAVObjSetData(AttitudeRawHandle(), dataIn)
#define AttitudeRawInstGet(instId, dataOut) UAVObjGetInstanceData(AttitudeRawHandle(), instId, dataOut)
#define AttitudeRawInstSet(instId, dataIn) UAVObjSetInstanceData(AttitudeRawHandle(), instId, dataIn)
#define AttitudeRawConnectQueue(queue) UAVObjConnectQueue(AttitudeRawHandle(), queue, EV_MASK_ALL_UPDATES)
#define AttitudeRawConnectCallback(cb) UAVObjConnectCallback(AttitudeRawHandle(), cb, EV_MASK_ALL_UPDATES)
#define AttitudeRawCreateInstance() UAVObjCreateInstance(AttitudeRawHandle())
#define AttitudeRawRequestUpdate() UAVObjRequestUpdate(AttitudeRawHandle())
#define AttitudeRawRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(AttitudeRawHandle(), instId)
#define AttitudeRawUpdated() UAVObjUpdated(AttitudeRawHandle())
#define AttitudeRawInstUpdated(instId) UAVObjUpdated(AttitudeRawHandle(), instId)
#define AttitudeRawGetMetadata(dataOut) UAVObjGetMetadata(AttitudeRawHandle(), dataOut)
#define AttitudeRawSetMetadata(dataIn) UAVObjSetMetadata(AttitudeRawHandle(), dataIn)
#define AttitudeRawReadOnly(dataIn) UAVObjReadOnly(AttitudeRawHandle())

// Object data
typedef struct {
    int16_t magnetometers[3];
    uint16_t gyros[3];
    float gyros_filtered[3];
    uint16_t gyrotemp[2];
    uint16_t accels[3];
    float accels_filtered[3];

} __attribute__((packed)) AttitudeRawData;

// Field information
// Field magnetometers information
/* Array element names for field magnetometers */
typedef enum { ATTITUDERAW_MAGNETOMETERS_X=0, ATTITUDERAW_MAGNETOMETERS_Y=1, ATTITUDERAW_MAGNETOMETERS_Z=2 } AttitudeRawmagnetometersElem;
/* Number of elements for field magnetometers */
#define ATTITUDERAW_MAGNETOMETERS_NUMELEM 3
// Field gyros information
/* Array element names for field gyros */
typedef enum { ATTITUDERAW_GYROS_X=0, ATTITUDERAW_GYROS_Y=1, ATTITUDERAW_GYROS_Z=2 } AttitudeRawgyrosElem;
/* Number of elements for field gyros */
#define ATTITUDERAW_GYROS_NUMELEM 3
// Field gyros_filtered information
/* Array element names for field gyros_filtered */
typedef enum { ATTITUDERAW_GYROS_FILTERED_X=0, ATTITUDERAW_GYROS_FILTERED_Y=1, ATTITUDERAW_GYROS_FILTERED_Z=2 } AttitudeRawgyros_filteredElem;
/* Number of elements for field gyros_filtered */
#define ATTITUDERAW_GYROS_FILTERED_NUMELEM 3
// Field gyrotemp information
/* Array element names for field gyrotemp */
typedef enum { ATTITUDERAW_GYROTEMP_XY=0, ATTITUDERAW_GYROTEMP_Z=1 } AttitudeRawgyrotempElem;
/* Number of elements for field gyrotemp */
#define ATTITUDERAW_GYROTEMP_NUMELEM 2
// Field accels information
/* Array element names for field accels */
typedef enum { ATTITUDERAW_ACCELS_X=0, ATTITUDERAW_ACCELS_Y=1, ATTITUDERAW_ACCELS_Z=2 } AttitudeRawaccelsElem;
/* Number of elements for field accels */
#define ATTITUDERAW_ACCELS_NUMELEM 3
// Field accels_filtered information
/* Array element names for field accels_filtered */
typedef enum { ATTITUDERAW_ACCELS_FILTERED_X=0, ATTITUDERAW_ACCELS_FILTERED_Y=1, ATTITUDERAW_ACCELS_FILTERED_Z=2 } AttitudeRawaccels_filteredElem;
/* Number of elements for field accels_filtered */
#define ATTITUDERAW_ACCELS_FILTERED_NUMELEM 3


// Generic interface functions
int32_t AttitudeRawInitialize();
UAVObjHandle AttitudeRawHandle();

#endif // ATTITUDERAW_H

/**
 * @}
 * @}
 */
