Commit Graph

108 Commits

Author SHA1 Message Date
Andrew Tridgell 7aeab8f5a8 AP_Common: added ARRAY_SIZE_SIMPLE()
this works with zero length arrays
2018-01-15 11:46:02 +11:00
Dr.-Ing. Amilcar Do Carmo Lucas 5a0ffe94d2 AP_Common: NFC spell in comments 2017-11-27 23:13:34 +09:00
Patrick José Pereira 9693da751e AP_common: Add stdio.h when using SITL_printf
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2017-10-24 22:55:56 +01:00
Lucas De Marchi 3102247a85 AP_Common: add FALLTHROUGH define 2017-08-22 23:59:13 -07:00
Dr.-Ing. Amilcar Do Carmo Lucas 8419045aea Spell in comments 2017-01-06 10:57:39 -08:00
Lucas De Marchi b0ddf81687 Remove stdbool.h include for C++ sources
This header is not needed in our C++ sources.
2016-12-16 11:38:52 -08:00
murata f9add59b58 Global: Aggregate the same definitions.
Global: Aggregate the same definitions.
2016-11-09 11:46:55 -03:00
Lucas De Marchi 6b88f3367b AP_Common: remove AP_PRODUCT_ID_* macros
These are not used anymore.
2016-11-09 17:08:05 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Lucas De Marchi 1962acad49 AP_Common: simplify ARRAY_SUBSCRIPT macro
Add DEFINE prefix, since this macro is defining these operators and
remove the parameter since we will always use it to access a
union/struct as a byte array.
2016-06-23 21:02:05 -03:00
Gustavo Jose de Sousa 5154369e9d AP_Common: define the ARRAY_SUBSCRIPT macro 2016-06-23 21:02:05 -03:00
Lucas De Marchi 8a58c06adb AP_Common: add macro to ignore unused result
In some cases we want to call functions annotated with
warn_unused_result but we know it's safe to ignore the return value.
Prefixing with (void) used to work, but it doesn't do anymore on all
versions of gcc and clang.
See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425

This solution is a mix of the solutions provided in the above bug report
and the one provided by Gustavo Sousa at
https://github.com/ArduPilot/ardupilot/pull/4277#issuecomment-224957375
2016-06-23 18:34:01 -03:00
Lucas De Marchi 7703e5f1d1 AP_Common: remove support for flymaple 2016-05-23 21:49:45 -03:00
Andrew Tridgell 5f7af390ec AP_Common: a useful debug macro for SITL 2016-05-23 10:10:29 +10:00
Tom Pittenger 02eeb2d4f0 AP_Common: 1of3 add loiter_xtrack option flag for post-loiter navigation
0 to crosstrack from center of waypoint, 1 to crosstrack from tangent exit location
2016-05-16 11:50:53 -07:00
Ricardo de Almeida Gonzaga a8889e5765 AP_Common: Fix typos 2016-05-13 19:20:05 -03:00
Randy Mackay cd999a2091 Location: initial class implementation 2016-04-30 10:33:01 +09:00
Lucas De Marchi bac29be0b7 AP_Common: remove warnings from headers
Let the warning flag be added by the build system and not when/if the
header AP_Common.h is included. Both waf and make were already updated
to contain these warnings. Besides being in the wrong place, with
clang++ we actually can't add "-Wno-" definitions in build system
because we enable all of the in the header with -Wall.
2016-02-12 20:41:30 +11:00
Andrew Tridgell 285294a9cd AP_Common: added debug code for qurt
and disable some warnings for clang++ on qurt
2015-12-27 16:21:25 +11:00
Tom Pittenger 41746733fe AP_Common: remove crazy #define float double
- not creating a warning buuuuuut this is just sooooo bad that it must be nuked on the spot
2015-12-07 15:50:07 +09:00
Lucas De Marchi d19c5035b6 Global: Rename printf format attribute
As commented in 8218140 ("AP_Common: add scanf format macro"), "FORMAT"
was a bad name for this macro since there's also the scanf. Rename to
FMT_PRINTF to follow the scanf name.
2015-12-01 07:22:12 +11:00
Andrew Tridgell 8739c55d27 AP_Common: added ID for FMUv4 2015-11-27 18:54:30 +11:00
Andrew Tridgell 090c02e6bd AP_Common: rename is_bounded() to is_bounded_int32() and make inclusive
we will probably want float versions in future, and inclusive is
better for the RC_Channel case
2015-11-11 13:45:05 +11:00
Grant Morphett ba8dbf6696 AP_Common: Added a new is_bounded global function. 2015-11-11 13:39:39 +11:00
Lucas De Marchi 821814007e AP_Common: add scanf format macro
Add a macro to annotate functions that act like scanf.  Calling the
printf format macro as FORMAT was bad as can be seen now. Later we need
to rename it to FMT_PRINTF.
2015-11-10 17:05:34 +11:00
Lucas De Marchi b734777b95 AP_Common: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:11 +11:00
Lucas De Marchi 9203e2b929 AP_Common: remove PSTR definition 2015-10-30 14:35:48 +09:00
Lucas De Marchi 20c6ffc5e3 Replace use of UARTDriver::printf_P() with UARTDriver::printf()
This also starts to show warnings on places that were already using
wrong printf format strings.
2015-10-30 14:35:25 +09:00
Lucas De Marchi dc95145de2 AP_Common: add attribute to sanitize prinf-like functions
Make the compiler emit warnings if the variables don't match the
printf format string. To be added in functions with printf-like
arguments.
2015-10-24 14:26:36 +11:00
Randy Mackay acd8252e4b Common: add location alt max definition 2015-10-19 16:15:05 +09:00
Lucas De Marchi 7ba6f92eb5 AP_Common: give some type safety to ARRAY_SIZE macro
Now that most places in the code use the ARRAY_SIZE macro instead of
coding it by hand, let's use some type safety in its definition. This is
a C++ version of similar macros used in kmod, Linux kernel and the
source of them, ccan.

A C++ version like this is used in V8 (the JS engine) and other open
source projects.

The main benefit of this version is that you get a compile error if you
pass in a variable that's not an array. For example,

     Bla y[10];
     Bla *y_ptr = y;

     void foo(Bla x[])
     {
         // build error since x[] decay to a pointer in function
         // parameter
         for (int i = 0; i < ARRAY_SIZE(x); i++) {
             ...
         }

         // build error since y_ptr is not an array
	 for (int i = 0; i < ARRAY_SIZE(y_ptr); i++) {
             ...
	 }
     }

I added the additional specialization to allow arrays of size 0.
2015-09-28 18:20:14 +10:00
Lucas De Marchi 82314ee4a3 AP_Common: add helper macro ARRAY_SIZE 2015-07-06 10:07:21 +10:00
Andrew Tridgell a1a3212131 AP_Common: moved NOINLINE define to AP_Common.h 2015-05-21 09:35:26 +10:00
Andrew Tridgell a53395cdb8 AP_Common: added HomeState enum from copter 2015-02-21 10:13:17 +11:00
Andrew Tridgell 26ac29840c AP_Common: added UNUSED_FUNCTION macro
useful for functions that are only in some builds
2015-02-18 11:12:43 +11:00
Grant Morphett 0b4ac5d256 AP_Common: Changes to fix the warnings in rover sitl build.
We are starting the process of resolving all the warnings in the
ardupilot builds of all vehicles and platforms.
2015-02-11 18:16:45 +11:00
Andrew Tridgell 5980ff8e1c AP_Common: removed map_baudrate()
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2015-01-29 15:47:48 +11:00
Andrew Tridgell 37dea4e367 AP_Common: added MPU9250 product ID 2014-10-24 12:10:39 +11:00
Andrew Tridgell 8a48f06d18 AP_Common: added terrain_alt flag to Location
signifies that the altitude is a above terrain altitude
2014-07-24 21:50:19 +10:00
Victor Mayoral Vilches 1445781104 AP_Common: added fire cape product ID 2014-07-14 08:16:29 +10:00
Randy Mackay b79f729540 AP_Common: add LOWBYTE, HIGHBYTE macros 2014-06-17 20:53:47 +10:00
Randy Mackay fa16e0967f AP_Common: remove unused location mask definitions 2014-06-17 20:53:45 +10:00
Andrew Tridgell 42c1501563 AP_Common: moved map_baudrate() into AP_Common
this version supports a much wider range of baudrates
2014-05-21 12:45:25 +10:00
Randy Mackay e3ffd5c0dd Common: remove RallyLocation defintion 2014-04-19 15:00:28 +09:00
Emile Castelnuovo 7b5c002d2f AP_Common: new board ID for VRBRAIN 2014-04-08 16:19:19 +10:00
Andrew Tridgell 959cafef8d AP_Common: make alt in Location 24 bit
this allows for up to 83km mission altitudes, while allowing for 1
more byte in the command structure, making p1 16 bits
2014-03-20 16:57:09 +11:00
Randy Mackay 865a4de33d Common: use PACKED instead of pragma pack for Location 2014-03-19 12:12:49 +09:00
Randy Mackay af186fba05 AP_Common: pack Location structure
This resolves issues storing and retrieving Location to eeprom as part
of AP_Mission
2014-03-19 12:11:13 +09:00
Randy Mackay 87126c9b71 Common: remove id and p1 from Location structure
id and p1 are now part of AP_Mission's Mission_Command structure
2014-03-19 12:10:46 +09:00
Randy Mackay 9ef27955b5 Common: add location options masks 2014-03-19 12:10:20 +09:00