2 ******************************************************************************
3 * @addtogroup UAVObjects OpenPilot UAVObjects
5 * @addtogroup $(NAME) $(NAME)
6 * @brief $(DESCRIPTION)
8 * Autogenerated files and functions for $(NAME) Object
13 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013.
14 * @brief Implementation of the $(NAME) object. This file has been
15 * automatically generated by the UAVObjectGenerator.
17 * @note Object definition file: $(XMLFILE).
18 * This is an automatically generated file.
19 * DO NOT modify manually.
21 * @see The GNU Public License (GPL) Version 3
23 *****************************************************************************/
25 * This program is free software; you can redistribute it and/or modify
26 * it under the terms of the GNU General Public License as published by
27 * the Free Software Foundation; either version 3 of the License, or
28 * (at your option) any later version.
30 * This program is distributed in the hope that it will be useful, but
31 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
32 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
35 * You should have received a copy of the GNU General Public License along
36 * with this program; if not, write to the Free Software Foundation, Inc.,
37 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
44 /* Object constants */
45 #define $(NAMEUC)_OBJID $(OBJIDHEX)
46 #define $(NAMEUC)_ISSINGLEINST $(ISSINGLEINST)
47 #define $(NAMEUC)_ISSETTINGS $(ISSETTINGS)
48 #define $(NAMEUC)_ISPRIORITY $(ISPRIORITY)
49 #define $(NAMEUC)_NUMBYTES sizeof($(NAME)Data)
51 /* Generic interface functions */
52 int32_t $(NAME)Initialize();
53 UAVObjHandle $(NAME)Handle();
54 void $(NAME)SetDefaults(UAVObjHandle obj, uint16_t instId);
60 * Packed Object data (unaligned).
61 * Should only be used where 4 byte alignment can be guaranteed
62 * (eg a single instance on the heap)
66 } __attribute__((packed)) $(NAME)DataPacked;
70 * Alignment is forced to 4 bytes so as to avoid the potential for CPU usage faults
71 * on Cortex M4F during load/store of float UAVO fields
73 typedef $(NAME)DataPacked __attribute__((aligned(4))) $(NAME)Data;
75 void $(NAME)DataOverrideDefaults($(NAME)Data * data);
77 /* Typesafe Object access functions */
78 static inline int32_t $(NAME)Get($(NAME)Data * dataOut) {
79 return UAVObjGetData($(NAME)Handle(), dataOut);
81 static inline int32_t $(NAME)Set(const $(NAME)Data * dataIn) {
82 return UAVObjSetData($(NAME)Handle(), dataIn);
84 static inline int32_t $(NAME)InstGet(uint16_t instId, $(NAME)Data * dataOut) {
85 return UAVObjGetInstanceData($(NAME)Handle(), instId, dataOut);
87 static inline int32_t $(NAME)InstSet(uint16_t instId, const $(NAME)Data * dataIn) {
88 return UAVObjSetInstanceData($(NAME)Handle(), instId, dataIn);
90 static inline int32_t $(NAME)ConnectQueue(xQueueHandle queue) {
91 return UAVObjConnectQueue($(NAME)Handle(), queue, EV_MASK_ALL_UPDATES);
93 static inline int32_t $(NAME)ConnectCallback(UAVObjEventCallback cb) {
94 return UAVObjConnectCallback($(NAME)Handle(), cb, EV_MASK_ALL_UPDATES, false);
96 static inline int32_t $(NAME)ConnectFastCallback(UAVObjEventCallback cb) {
97 return UAVObjConnectCallback($(NAME)Handle(), cb, EV_MASK_ALL_UPDATES, true);
99 static inline uint16_t $(NAME)CreateInstance() {
100 return UAVObjCreateInstance($(NAME)Handle());
102 static inline void $(NAME)RequestUpdate() {
103 UAVObjRequestUpdate($(NAME)Handle());
105 static inline void $(NAME)RequestInstUpdate(uint16_t instId) {
106 UAVObjRequestInstanceUpdate($(NAME)Handle(), instId);
108 static inline void $(NAME)Updated() {
109 UAVObjUpdated($(NAME)Handle());
111 static inline void $(NAME)InstUpdated(uint16_t instId) {
112 UAVObjInstanceUpdated($(NAME)Handle(), instId);
114 static inline void $(NAME)Logging() {
115 UAVObjLogging($(NAME)Handle());
117 static inline void $(NAME)InstLogging(uint16_t instId) {
118 UAVObjInstanceLogging($(NAME)Handle(), instId);
120 static inline int32_t $(NAME)GetMetadata(UAVObjMetadata * dataOut) {
121 return UAVObjGetMetadata($(NAME)Handle(), dataOut);
123 static inline int32_t $(NAME)SetMetadata(const UAVObjMetadata * dataIn) {
124 return UAVObjSetMetadata($(NAME)Handle(), dataIn);
126 static inline int8_t $(NAME)ReadOnly() {
127 return UAVObjReadOnly($(NAME)Handle());
130 /* Set/Get functions */
131 $(SETGETFIELDSEXTERN)
133 #endif // $(NAMEUC)_H