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
43 /* Object constants */
44 #define $(NAMEUC)_OBJID $(OBJIDHEX)
45 #define $(NAMEUC)_ISSINGLEINST $(ISSINGLEINST)
46 #define $(NAMEUC)_ISSETTINGS $(ISSETTINGS)
47 #define $(NAMEUC)_ISPRIORITY $(ISPRIORITY)
48 #define $(NAMEUC)_NUMBYTES sizeof($(NAME)Data)
50 /* Generic interface functions */
51 int32_t $(NAME)Initialize();
52 UAVObjHandle $(NAME)Handle();
53 void $(NAME)SetDefaults(UAVObjHandle obj, uint16_t instId);
59 * Packed Object data (unaligned).
60 * Should only be used where 4 byte alignment can be guaranteed
61 * (eg a single instance on the heap)
65 } __attribute__((packed)) $(NAME)DataPacked;
69 * Alignment is forced to 4 bytes so as to avoid the potential for CPU usage faults
70 * on Cortex M4F during load/store of float UAVO fields
72 typedef $(NAME)DataPacked __attribute__((aligned(4))) $(NAME)Data;
74 /* Typesafe Object access functions */
75 static inline int32_t $(NAME)Get($(NAME)Data * dataOut) {
76 return UAVObjGetData($(NAME)Handle(), dataOut);
78 static inline int32_t $(NAME)Set(const $(NAME)Data * dataIn) {
79 return UAVObjSetData($(NAME)Handle(), dataIn);
81 static inline int32_t $(NAME)InstGet(uint16_t instId, $(NAME)Data * dataOut) {
82 return UAVObjGetInstanceData($(NAME)Handle(), instId, dataOut);
84 static inline int32_t $(NAME)InstSet(uint16_t instId, const $(NAME)Data * dataIn) {
85 return UAVObjSetInstanceData($(NAME)Handle(), instId, dataIn);
87 static inline int32_t $(NAME)ConnectQueue(xQueueHandle queue) {
88 return UAVObjConnectQueue($(NAME)Handle(), queue, EV_MASK_ALL_UPDATES);
90 static inline int32_t $(NAME)ConnectCallback(UAVObjEventCallback cb) {
91 return UAVObjConnectCallback($(NAME)Handle(), cb, EV_MASK_ALL_UPDATES, false);
93 static inline int32_t $(NAME)ConnectFastCallback(UAVObjEventCallback cb) {
94 return UAVObjConnectCallback($(NAME)Handle(), cb, EV_MASK_ALL_UPDATES, true);
96 static inline uint16_t $(NAME)CreateInstance() {
97 return UAVObjCreateInstance($(NAME)Handle(), &$(NAME)SetDefaults);
99 static inline void $(NAME)RequestUpdate() {
100 UAVObjRequestUpdate($(NAME)Handle());
102 static inline void $(NAME)RequestInstUpdate(uint16_t instId) {
103 UAVObjRequestInstanceUpdate($(NAME)Handle(), instId);
105 static inline void $(NAME)Updated() {
106 UAVObjUpdated($(NAME)Handle());
108 static inline void $(NAME)InstUpdated(uint16_t instId) {
109 UAVObjInstanceUpdated($(NAME)Handle(), instId);
111 static inline void $(NAME)Logging() {
112 UAVObjLogging($(NAME)Handle());
114 static inline void $(NAME)InstLogging(uint16_t instId) {
115 UAVObjInstanceLogging($(NAME)Handle(), instId);
117 static inline int32_t $(NAME)GetMetadata(UAVObjMetadata * dataOut) {
118 return UAVObjGetMetadata($(NAME)Handle(), dataOut);
120 static inline int32_t $(NAME)SetMetadata(const UAVObjMetadata * dataIn) {
121 return UAVObjSetMetadata($(NAME)Handle(), dataIn);
123 static inline int8_t $(NAME)ReadOnly() {
124 return UAVObjReadOnly($(NAME)Handle());
127 /* Set/Get functions */
128 $(SETGETFIELDSEXTERN)
130 #endif // $(NAMEUC)_H