1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-10 18:24:11 +01:00
LibrePilot/flight/uavobjects/inc/uavobject.h.template

136 lines
4.5 KiB
Plaintext
Raw Normal View History

2013-04-05 22:46:56 +02:00
/**
******************************************************************************
* @addtogroup UAVObjects OpenPilot UAVObjects
2016-02-07 16:31:15 +01:00
* @{
* @addtogroup $(NAME) $(NAME)
2013-04-05 22:46:56 +02:00
* @brief $(DESCRIPTION)
*
* Autogenerated files and functions for $(NAME) Object
*
2016-02-07 16:31:15 +01:00
* @{
2013-04-05 22:46:56 +02:00
*
* @file $(NAMELC).h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013.
2016-02-07 16:31:15 +01:00
* @brief Implementation of the $(NAME) object. This file has been
2013-04-05 22:46:56 +02:00
* automatically generated by the UAVObjectGenerator.
2016-02-07 16:31:15 +01:00
*
* @note Object definition file: $(XMLFILE).
2013-04-05 22:46:56 +02:00
* 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 $(NAMEUC)_H
#define $(NAMEUC)_H
2016-02-07 16:31:15 +01:00
#include <stdbool.h>
/* Object constants */
2013-04-05 22:46:56 +02:00
#define $(NAMEUC)_OBJID $(OBJIDHEX)
#define $(NAMEUC)_ISSINGLEINST $(ISSINGLEINST)
#define $(NAMEUC)_ISSETTINGS $(ISSETTINGS)
#define $(NAMEUC)_ISPRIORITY $(ISPRIORITY)
2013-04-05 22:46:56 +02:00
#define $(NAMEUC)_NUMBYTES sizeof($(NAME)Data)
/* Generic interface functions */
2013-04-05 22:46:56 +02:00
int32_t $(NAME)Initialize();
UAVObjHandle $(NAME)Handle();
void $(NAME)SetDefaults(UAVObjHandle obj, uint16_t instId);
$(DATAFIELDINFO)
$(DATASTRUCTURES)
/*
* Packed Object data (unaligned).
* Should only be used where 4 byte alignment can be guaranteed
* (eg a single instance on the heap)
*/
2013-04-05 22:46:56 +02:00
typedef struct {
2016-02-07 16:31:15 +01:00
$(DATAFIELDS)
} __attribute__((packed)) $(NAME)DataPacked;
2013-04-05 22:46:56 +02:00
/*
* Packed Object data.
* Alignment is forced to 4 bytes so as to avoid the potential for CPU usage faults
* on Cortex M4F during load/store of float UAVO fields
*/
typedef $(NAME)DataPacked __attribute__((aligned(4))) $(NAME)Data;
2016-02-07 16:31:15 +01:00
/* Typesafe Object access functions */
2016-02-07 16:31:15 +01:00
static inline int32_t $(NAME)Get($(NAME)Data * dataOut) {
return UAVObjGetData($(NAME)Handle(), dataOut);
}
static inline int32_t $(NAME)Set(const $(NAME)Data * dataIn) {
return UAVObjSetData($(NAME)Handle(), dataIn);
}
static inline int32_t $(NAME)InstGet(uint16_t instId, $(NAME)Data * dataOut) {
return UAVObjGetInstanceData($(NAME)Handle(), instId, dataOut);
}
static inline int32_t $(NAME)InstSet(uint16_t instId, const $(NAME)Data * dataIn) {
return UAVObjSetInstanceData($(NAME)Handle(), instId, dataIn);
}
static inline int32_t $(NAME)ConnectQueue(xQueueHandle queue) {
return UAVObjConnectQueue($(NAME)Handle(), queue, EV_MASK_ALL_UPDATES);
}
static inline int32_t $(NAME)ConnectCallback(UAVObjEventCallback cb) {
return UAVObjConnectCallback($(NAME)Handle(), cb, EV_MASK_ALL_UPDATES, false);
}
static inline int32_t $(NAME)ConnectFastCallback(UAVObjEventCallback cb) {
return UAVObjConnectCallback($(NAME)Handle(), cb, EV_MASK_ALL_UPDATES, true);
}
static inline uint16_t $(NAME)CreateInstance() {
return UAVObjCreateInstance($(NAME)Handle(), &$(NAME)SetDefaults);
}
static inline void $(NAME)RequestUpdate() {
UAVObjRequestUpdate($(NAME)Handle());
}
static inline void $(NAME)RequestInstUpdate(uint16_t instId) {
UAVObjRequestInstanceUpdate($(NAME)Handle(), instId);
}
static inline void $(NAME)Updated() {
UAVObjUpdated($(NAME)Handle());
}
static inline void $(NAME)InstUpdated(uint16_t instId) {
UAVObjInstanceUpdated($(NAME)Handle(), instId);
}
static inline void $(NAME)Logging() {
UAVObjLogging($(NAME)Handle());
}
static inline void $(NAME)InstLogging(uint16_t instId) {
UAVObjInstanceLogging($(NAME)Handle(), instId);
}
static inline int32_t $(NAME)GetMetadata(UAVObjMetadata * dataOut) {
return UAVObjGetMetadata($(NAME)Handle(), dataOut);
}
static inline int32_t $(NAME)SetMetadata(const UAVObjMetadata * dataIn) {
return UAVObjSetMetadata($(NAME)Handle(), dataIn);
}
static inline int8_t $(NAME)ReadOnly() {
return UAVObjReadOnly($(NAME)Handle());
}
2013-04-05 22:46:56 +02:00
/* Set/Get functions */
2013-04-05 22:46:56 +02:00
$(SETGETFIELDSEXTERN)
#endif // $(NAMEUC)_H
/**
* @}
* @}
*/