5
0
mirror of https://github.com/ArduPilot/ardupilot synced 2025-01-02 22:18:28 -04:00

Drop a couple things in here in support of code moving to libraries.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@455 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
DrZiplok@gmail.com 2010-09-11 06:13:28 +00:00
parent 8a4b060873
commit 10f3a6f9cb
2 changed files with 73 additions and 0 deletions
libraries/AP_Common

View File

@ -0,0 +1,17 @@
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
//
// This is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 2.1 of the License, or (at
// your option) any later version.
//
/// @file AP_Common.cpp
/// @brief Common utility routines for the ArduPilot libraries.
///
/// @note Exercise restraint adding code here; everything in this
/// library will be linked with any sketch using it.
///
#include "AP_Common.h"

View File

@ -0,0 +1,56 @@
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
//
// This is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 2.1 of the License, or (at
// your option) any later version.
//
#ifndef _AP_COMMON_H
#define _AP_COMMON_H
///
/// @file AP_Common.h
/// @brief Common definitions and utility routines for the ArduPilot
/// libraries.
///
/// @note For correct operation, all sketches and libraries should
/// include this header *before* any other. In
/// particular, this is critical for things like the
/// FastSerial library, which need the opportunity to
/// override parts of the Arduino infrastructure.
///
////////////////////////////////////////////////////////////////////////////////
/// @name Types
///
/// Data structures and types used throughout the libraries and applications.
///
//@{
struct Location {
uint8_t id; ///< command id
uint8_t p1; ///< param 1
int32_t alt; ///< param 2 - Altitude in centimeters (meters * 100)
int32_t lat; ///< param 3 - Lattitude * 10**7
int32_t lng; ///< param 4 - Longitude * 10**7
};
//@}
////////////////////////////////////////////////////////////////////////////////
/// @name Conversions
///
/// Conversion macros and factors.
///
//@{
/// XXX this should probably be replaced with radians()/degrees(), but their
/// inclusion in wiring.h makes doing that here difficult.
#define ToDeg(x) (x*57.2957795131) // *180/pi
//@}
#endif // _AP_COMMON_H