• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

AP_Common.h

Go to the documentation of this file.
00001 // -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
00002 //
00003 // This is free software; you can redistribute it and/or modify it under
00004 // the terms of the GNU Lesser General Public License as published by the
00005 // Free Software Foundation; either version 2.1 of the License, or (at
00006 // your option) any later version.
00007 //
00008 
00014 
00015 #ifndef _AP_COMMON_H
00016 #define _AP_COMMON_H
00017 
00018 #include <stdint.h>
00019 #include "include/menu.h"               
00020 #include "c++.h" // c++ additions
00021 #include "AP_Vector.h"
00022 #include "AP_Loop.h"
00023 #include "AP_Var.h"
00024 
00027 
00028 //
00029 // Turn on/off warnings of interest.
00030 //
00031 // These warnings are normally suppressed by the Arduino IDE,
00032 // but with some minor hacks it's possible to have warnings
00033 // emitted.  This helps greatly when diagnosing subtle issues.
00034 //
00035 #pragma GCC diagnostic warning "-Wall"
00036 #pragma GCC diagnostic warning "-Wextra"
00037 #pragma GCC diagnostic warning "-Wlogical-op"
00038 #pragma GCC diagnostic ignored "-Wredundant-decls"
00039 
00040 // Make some dire warnings into errors
00041 //
00042 // Some warnings indicate questionable code; rather than let
00043 // these slide, we force them to become errors so that the
00044 // developer has to find a safer alternative.
00045 //
00046 #pragma GCC diagnostic error "-Wfloat-equal"
00047 
00048 // The following is strictly for type-checking arguments to printf_P calls
00049 // in conjunction with a suitably modified Arduino IDE; never define for
00050 // production as it generates bad code.
00051 //
00052 #if PRINTF_FORMAT_WARNING_DEBUG
00053 # undef PSTR
00054 # define PSTR(_x)               _x              // help the compiler with printf_P
00055 # define float double                   // silence spurious format warnings for %f
00056 #else
00057 // This is a workaround for GCC bug c++/34734.
00058 //
00059 // The C++ compiler normally emits many spurious warnings for the use
00060 // of PSTR (even though it generates correct code).  This workaround
00061 // has an equivalent effect but avoids the warnings, which otherwise
00062 // make finding real issues difficult.
00063 //
00064 # undef PROGMEM
00065 # define PROGMEM __attribute__(( section(".progmem.data") ))
00066 # undef PSTR
00067 # define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];}))
00068 #endif
00069 
00070 
00074 #define ToRad(x) (x*0.01745329252)      // *pi/180
00075 #define ToDeg(x) (x*57.2957795131)      // *180/pi
00076 // @}
00077 
00078 
00084 
00085 
00086 struct Location {
00087         uint8_t         id;                                     
00088         uint8_t         p1;                                     
00089         int32_t         alt;                            
00090         int32_t         lat;                            
00091         int32_t         lng;                            
00092 };
00093 
00095 
00101 
00102 
00105 #define ToDeg(x) (x*57.2957795131)      // *180/pi
00106 #define ToRad(x) (x*0.01745329252)      // *pi/180
00107 
00109 
00110 
00111 #endif // _AP_COMMON_H

Generated for ArduPilot Libraries by doxygen