mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Adding gpstime.h for flight.
Seriously - I'm sorry I missed all these files. I suck. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1443 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
8f940ab4b1
commit
00cad250ea
111
flight/OpenPilot/UAVObjects/gpstime.c
Normal file
111
flight/OpenPilot/UAVObjects/gpstime.c
Normal file
@ -0,0 +1,111 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup GPSTime GPSTime
|
||||
* @brief Contains the GPS time from @ref GPSModule. Required to compute the world magnetic model correctly when setting the home location.
|
||||
*
|
||||
* Autogenerated files and functions for GPSTime Object
|
||||
* @{
|
||||
*
|
||||
* @file gpstime.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the GPSTime object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: gpstime.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
|
||||
*/
|
||||
|
||||
#include "openpilot.h"
|
||||
#include "gpstime.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t GPSTimeInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(GPSTIME_OBJID, GPSTIME_NAME, GPSTIME_METANAME, 0,
|
||||
GPSTIME_ISSINGLEINST, GPSTIME_ISSETTINGS, GPSTIME_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
GPSTimeData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(GPSTimeData));
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.access = ACCESS_READWRITE;
|
||||
metadata.gcsAccess = ACCESS_READWRITE;
|
||||
metadata.telemetryAcked = 0;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.telemetryUpdatePeriod = 10000;
|
||||
metadata.gcsTelemetryAcked = 0;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.loggingUpdatePeriod = 30000;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle GPSTimeHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
101
flight/OpenPilot/UAVObjects/inc/gpstime.h
Normal file
101
flight/OpenPilot/UAVObjects/inc/gpstime.h
Normal file
@ -0,0 +1,101 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup GPSTime GPSTime
|
||||
* @brief Contains the GPS time from @ref GPSModule. Required to compute the world magnetic model correctly when setting the home location.
|
||||
*
|
||||
* Autogenerated files and functions for GPSTime Object
|
||||
|
||||
* @{
|
||||
*
|
||||
* @file gpstime.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the GPSTime object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: gpstime.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 GPSTIME_H
|
||||
#define GPSTIME_H
|
||||
|
||||
// Object constants
|
||||
#define GPSTIME_OBJID 1459613858U
|
||||
#define GPSTIME_NAME "GPSTime"
|
||||
#define GPSTIME_METANAME "GPSTimeMeta"
|
||||
#define GPSTIME_ISSINGLEINST 1
|
||||
#define GPSTIME_ISSETTINGS 0
|
||||
#define GPSTIME_NUMBYTES sizeof(GPSTimeData)
|
||||
|
||||
// Object access macros
|
||||
/**
|
||||
* @function GPSTimeGet(dataOut)
|
||||
* @brief Populate a GPSTimeData object
|
||||
* @param[out] dataOut
|
||||
*/
|
||||
#define GPSTimeGet(dataOut) UAVObjGetData(GPSTimeHandle(), dataOut)
|
||||
#define GPSTimeSet(dataIn) UAVObjSetData(GPSTimeHandle(), dataIn)
|
||||
#define GPSTimeInstGet(instId, dataOut) UAVObjGetInstanceData(GPSTimeHandle(), instId, dataOut)
|
||||
#define GPSTimeInstSet(instId, dataIn) UAVObjSetInstanceData(GPSTimeHandle(), instId, dataIn)
|
||||
#define GPSTimeConnectQueue(queue) UAVObjConnectQueue(GPSTimeHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define GPSTimeConnectCallback(cb) UAVObjConnectCallback(GPSTimeHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define GPSTimeCreateInstance() UAVObjCreateInstance(GPSTimeHandle())
|
||||
#define GPSTimeRequestUpdate() UAVObjRequestUpdate(GPSTimeHandle())
|
||||
#define GPSTimeRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(GPSTimeHandle(), instId)
|
||||
#define GPSTimeUpdated() UAVObjUpdated(GPSTimeHandle())
|
||||
#define GPSTimeInstUpdated(instId) UAVObjUpdated(GPSTimeHandle(), instId)
|
||||
#define GPSTimeGetMetadata(dataOut) UAVObjGetMetadata(GPSTimeHandle(), dataOut)
|
||||
#define GPSTimeSetMetadata(dataIn) UAVObjSetMetadata(GPSTimeHandle(), dataIn)
|
||||
#define GPSTimeReadOnly(dataIn) UAVObjReadOnly(GPSTimeHandle())
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
int8_t Month;
|
||||
int8_t Day;
|
||||
int16_t Year;
|
||||
int8_t Hour;
|
||||
int8_t Minute;
|
||||
int8_t Second;
|
||||
|
||||
} __attribute__((packed)) GPSTimeData;
|
||||
|
||||
// Field information
|
||||
// Field Month information
|
||||
// Field Day information
|
||||
// Field Year information
|
||||
// Field Hour information
|
||||
// Field Minute information
|
||||
// Field Second information
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t GPSTimeInitialize();
|
||||
UAVObjHandle GPSTimeHandle();
|
||||
|
||||
#endif // GPSTIME_H
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user