Pierre Kancir
121e5d0abf
AP_Math: move location_3d_diff_NED to Location and rename
2019-04-09 20:59:48 +10:00
Pierre Kancir
29b2d7996b
AP_Common: move check_latlng to Location
2019-04-08 12:56:01 -07:00
Pierre Kancir
b10e75f4e1
AP_Math: move locations_are_same to Location and rename to same_latlon_as
2019-04-08 08:05:05 -07:00
Pierre Kancir
00fa07ef33
AP_Math: move location_diff to Location and rename
2019-04-08 08:00:52 -07:00
Pierre Kancir
a30404fb11
AP_Common: move location_update to Location and rename to offset_bearing
2019-04-06 09:10:28 +11:00
Pierre Kancir
6faf1d2849
AP_Common: move get_bearing_cd to Location and rename to get_bearing_to
2019-04-06 09:10:28 +11:00
Peter Barker
a6755b6406
AP_Common: correct type conversion issues in _assert_storage_size
2019-04-05 05:48:41 -07:00
Peter Barker
fd294101ec
AP_Common: Location: move sanitize to be a method on location
2019-04-02 10:19:38 +11:00
murata
7340502f18
AP_Common: Set the value of UINT16 with HIGH byte and LOW byte
2019-03-28 12:02:55 +11:00
Peter Barker
649130adcb
AP_Common: uniqify semaphore names
2019-03-23 11:23:07 +11:00
Peter Barker
22c0175d7f
AP_Location: use enum class for AltFrame enumeration
2019-03-19 10:31:18 +11:00
Peter Barker
a1c751919c
AP_Common: move longitude_scale into Location class
2019-03-12 10:11:12 +11:00
Tom Pittenger
785c91e269
AP_Common: Semaphore is missing an include
...
Everyone who is already including common/Semaphore has extra includes to make this compile. This reduces that dependancy
2019-03-08 17:24:48 -08:00
Peter Barker
7f63720257
AP_Common: Location.cpp: force handling of all alt frames
...
By removing the default case we will generate a compiler error a new alt
frame is not handled
2019-03-05 10:39:29 +11:00
Peter Barker
c3004bff20
AP_Common: remove keywords.txt
2019-02-17 00:29:38 -08:00
Peter Barker
b97f9cc555
AP_Common: remove NuttX/C++10-related code
2019-02-15 08:15:45 +11:00
Peter Barker
7259f3fa2f
AP_Common: rearrange headers for consistency
...
Move attribute definitions all into AP_Common, rather than being split between two files
Remove unused SITL_printf macros
Stop AP_Common including board information
Include AP_Common.h in AP_HAL::Sempahore for WARN_IF_UNUSED; this was the cause of a circular import problem fixed by other commits in this patch.
2019-02-15 08:15:45 +11:00
Dr.-Ing. Amilcar do Carmo Lucas
8b54b6a5cf
AP_Common: Move LOCATION_ALT_MAX_M declaration from AP_Common.h to Location.h
...
This reduces the scope of this constant, and moves it to the file that actually depends on it
2019-02-13 11:53:18 +09:00
Peter Barker
57804e3118
AP_Common: unify Location_Class and Location
2019-01-16 11:45:29 +11:00
Peter Barker
a3a012b77e
AP_Common: remove packed nature of Location, move flags out of union
...
This saves ~2.5kB on fmuv3
2019-01-16 11:45:29 +11:00
Peter Barker
4dc157951b
AP_Common: add template to check structure size
...
This has the advantage of telling you what the sizes are
In file included from ../../libraries/AC_AttitudeControl/AC_PosControl.h:3:
../../libraries/AP_Common/AP_Common.h:103:3: fatal error: static_assert failed "wrong size"
static_assert(s == t, "wrong size");
^ ~~~~~~
../../libraries/AP_Common/AP_Common.h:147:52: note: in instantiation of template class 'assert_structure_size<12, 11>' requested here
assert_structure_size<sizeof(struct Location), 11> _assert_location_size;
2019-01-16 11:45:29 +11:00
Peter Barker
e198b0c7e6
AP_Common: Bitmask: choose builtin based on type for find_first_set
2018-12-10 12:52:41 +09:00
Peter Barker
a7ce326307
AP_Common: Bitmask: use sizeof() in place of constant
2018-12-10 12:52:41 +09:00
Peter Barker
db5f933e7a
AP_Common: Bitmask: add assignment operator
2018-12-10 12:52:41 +09:00
Peter Barker
942555ceb8
AP_Common: add tests for Bitmask
2018-12-10 12:52:41 +09:00
Andrew Tridgell
0fcb22afde
AP_Common: added first_set() method to Bitmask
2018-12-10 12:52:41 +09:00
Peter Barker
09bdb6315b
AP_Common: define WEAK attribute
2018-12-10 12:52:41 +09:00
Peter Barker
6b7e04da06
AP_Common: Bitmask: remove copy operator and constructor
2018-11-05 12:17:55 +09:00
Lucas De Marchi
cb10d1d27b
AP_Common: allow more than one WITH_SEMAPHORE per context
...
Let the variable have a random name since we are not going to reference
it. This allows more than one WITH_SEMAPHORE() per context and also to
avoid shadowing if we open inner contexts.
2018-09-06 08:23:02 +10:00
Lucas De Marchi
1715714488
AP_Common: make WithSemaphore use an AP_HAL::Semaphore reference
...
We don't need the specialized one inside WithSemaphore, so use the
abstract one which allows us to more easily convert between current API
and the HAL_Semaphore one.
While at it also remove additional pragma and allow constructor to
receive a pointer for convenience (we will just dereference it).
2018-09-06 08:23:02 +10:00
Andrew Tridgell
0aeceb22d9
AP_Common: added #pragma once to Semaphores.h
2018-08-25 15:44:36 +10:00
Andrew Tridgell
912e4f16ec
AP_Common: added #pragma once
2018-08-23 08:21:48 +10:00
Andrew Tridgell
5ac15714fd
AP_Common: moved WITH_SEMAPHORE to Semaphore.h
2018-08-16 12:40:10 +10:00
Andrew Tridgell
6f058e8c0d
AP_Common: added WithSemaphore class
2018-08-16 12:40:10 +10:00
Lucas De Marchi
88df4d127e
AP_Common: remove ARRAY_SIZE_SIMPLE
...
Now this is basically ARRAY_SIZE, so remove it.
2018-08-04 15:31:55 +10:00
Lucas De Marchi
57ee0e29f6
AP_Common: simplify ARRAY_SIZE
...
This rolls back to the simpler version of ARRAY_SIZE. The more complex
one helps catching bugs when we use pointers when we are expecting an
array, but can't stand arrays with 0 elements. I'm not aware of bugs it
actually caught on ArduPilot, although it did for me in other projects.
I think this is better than having a separate "_SIMPLE" version of the
macro and spread its usage... the trend is just to use the simpler
version anyway.
2018-08-04 15:31:55 +10:00
Peter Barker
6ba1678c5e
AP_Common: AP_FWVersion: create singleton
2018-06-18 19:10:37 +01:00
Peter Barker
dc202c1ff9
AP_Common: Location: use AP_AHRS singleton
2018-06-01 16:18:33 +01:00
Peter Barker
9a345160c1
AP_Common: fail attempts to use frame-above-home if home is not set
2018-06-01 16:18:33 +01:00
Peter Barker
28b4794816
AP_Common: remove unused HomeState
2018-05-29 14:38:45 +10:00
Francisco Ferreira
f8756fac6b
AP_Common: remove Qualcomm board support
2018-05-17 09:57:20 +10:00
Pierre Kancir
79cd137625
AP_Common: remove AP_AHRS_NavEKF include from location class
2018-04-11 08:59:50 +09:00
Andrew Tridgell
93bd546e6c
AP_Common: fixed cygwin ChibiOS build
...
handle short path length errors
2018-03-02 17:11:31 +11:00
Andrew Tridgell
7aeab8f5a8
AP_Common: added ARRAY_SIZE_SIMPLE()
...
this works with zero length arrays
2018-01-15 11:46:02 +11:00
Peter Barker
302e5c6871
AP_Common: have get_vector_xy_from_origin_NE take a Vector2f rather than 3f
...
Also, rename it from get_vector_xy_from_origin_NED
2017-12-15 01:24:13 +00: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
54a4a78795
AP_Common: do not include version.h/ap_version.h
...
The interface provided by each vehicle should be used to get the
version.
2017-09-23 21:37:45 -07:00
Lucas De Marchi
370e10281b
AP_Common: AP_FWVersion: add pointers to git hash strings
...
Keeping the hash strings on this struct allow to handle them
the same way on common code and remove ifdefs.
2017-09-23 21:37:45 -07:00
squilter
1a9bccaaa7
AP_Common: fix Bitmask out-of-range values
2017-09-09 14:05:41 +09:00
Randy Mackay
963c9c93fe
AP_Common: constify bitmask
2017-09-09 14:05:41 +09:00
Randy Mackay
f187df225a
AP_Common: add setall, count and size methods to Bitmask
2017-09-09 14:05:41 +09:00
Peter Barker
445777429b
AP_FWVersion: add structure to hold firmware version
2017-08-30 15:54:46 +01:00
Randy Mackay
aaac6b3692
AP_Common: Bitmask formatting fix
2017-08-30 20:07:04 +09:00
Lucas De Marchi
3102247a85
AP_Common: add FALLTHROUGH define
2017-08-22 23:59:13 -07:00
Andrew Tridgell
71158e3e74
AP_Common: added #pragma once
2017-05-06 15:21:14 +10:00
Pierre Kancir
2200302081
AP_Common: example fix travis warning
...
missing function declaration
implicit cast
some style fix
2017-04-13 19:56:16 +01:00
murata
50eead63cc
AP_Common: Unify from print or println to printf.
2017-01-27 18:20:22 +11: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
Andrew Tridgell
6adad11e2f
AP_Common: added simple bitmask class
2016-12-02 09:49:39 +11: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
Lucas De Marchi
2e4c1818a3
AP_Common: add missing O_CLOEXEC definition
...
O_CLOEXEC is not available on Nuttx, nor it makes sense there. Define it
as 0, so we can use it in code.
2016-11-07 12:37:30 -03:00
murata
c808ee2f49
Global: To nullptr from NULL.
...
RC_Channel: To nullptr from NULL.
AC_Fence: To nullptr from NULL.
AC_Avoidance: To nullptr from NULL.
AC_PrecLand: To nullptr from NULL.
DataFlash: To nullptr from NULL.
SITL: To nullptr from NULL.
GCS_MAVLink: To nullptr from NULL.
DataFlash: To nullptr from NULL.
AP_Compass: To nullptr from NULL.
Global: To nullptr from NULL.
Global: To nullptr from NULL.
2016-11-02 16:04:47 -02: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
ae53920e5b
build: don't build examples with old build system
...
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file. Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Leandro Pereira
0f865a019a
AP_HAL_Linux: Add Pollable/Poller
...
Add system's polling infrastructure to be notified whenever a
file descriptor is ready to be read from or written to.
Adds a few classes:
* Poller, as an interface to epoll()
* Pollable, as an interface to a file descriptor
2016-07-30 00:55:27 -03:00
Tom Pittenger
b78255cc25
AP_Common: avoid using AP_Math is_zero() because it is classless
...
- because it is classless it can not be called like AP_Math::is_zero() and will then conflict with local definition of is_zero()
2016-07-20 22:32:47 -07:00
Tom Pittenger
3edd95b99b
AP_Common: add Location::is_zero and ::zero member functions
2016-07-20 22:32:47 -07:00
Lucas De Marchi
471de28967
AP_Common: provide minimal byteswap.h and endian.h
2016-07-08 19:49:32 -03:00
Lucas De Marchi
c728b6c164
AP_Common: missing/fenv: fix coding style
2016-07-07 11:35:18 -03:00
Siddharth Bharat Purohit
484db9ff82
AP_Common: add replacements for fe control functions systems without them
2016-07-07 11:35:18 -03: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
Francisco Ferreira
ac90527da5
AP_Common: change check from GCC version to glibc version (and Cygwin)
2016-06-23 18:19:54 +10:00
Lucas De Marchi
39d4fa2cf8
Revert changes to cmath according to gcc version
...
Revert these commits:
"AP_Common: gcc 4.9.2 behaves differently from 4.9.3"
"AP_Common: this workaround for missing/cmath is also needed for gcc 4.9.3"
This breaks the build for PX4. The change is related to the libc, not
the compiler version. We have an workaround there based on compiler
version just because it's usual to have a more recent libc version when
you have a recent compiler.
2016-06-21 13:54:41 -03:00
Andrew Tridgell
2108127712
AP_Common: gcc 4.9.2 behaves differently from 4.9.3
...
tested 4.9.3 on cygwin, 4.9.2 on ubuntu
I do hope that it doesn't depend on the OS
2016-06-21 21:34:54 +10:00
Andrew Tridgell
224c714c83
AP_Common: this workaround for missing/cmath is also needed for gcc 4.9.3
...
tested on cygwin with 4.9.3
2016-06-21 19:19:09 +10: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
f085666032
AP_Common: fix compile when using AP_TERRAIN_AVAILABLE 0
2016-05-20 12:28:46 -07:00
Lucas De Marchi
c4306de122
AP_Common: fix build on windows
...
The way the build was fixed for gcc >= 5.3 breaks the build for older
compiler versions on waf. Fix this by ifdef'ing for WAF_BUILD and
checking the compiler version.
2016-05-18 22:56:50 -03:00
Andrew Tridgell
7b47d54d6b
AP_Common: workaround for SITL on windows
2016-05-17 20:55:57 +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
dgrat
41661f815f
AP_Math: Replace the pythagorous* functions with a variadic template
...
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
Lucas De Marchi
fea084a596
Global: use ap_version.h
...
This header is used by waf to contain the generated version macros,
particularly using the git hash. For waf it's better to be in a separate
header since it then can keep track of changes on it a trigger
recompilation.
For the make build system, a dummy ap_version.h file has been added in
the missing/ folder so both implementations can co-exist.
2016-05-06 13:11:28 -03:00
Lucas De Marchi
1238c872a9
AP_Common: remove unused Arduino.h header
2016-05-06 13:11:27 -03:00
Randy Mackay
85963cecb4
Location: add additional comments
2016-04-30 10:33:01 +09:00
Randy Mackay
5161d63f8b
Location: operator= uses const reference
2016-04-30 10:33:01 +09:00
Randy Mackay
d6309a3a1a
Location: remove unused methods
2016-04-30 10:33:01 +09:00
Randy Mackay
1bfb565e18
Location: rename set_alt to set_alt_cm
2016-04-30 10:33:01 +09:00
Randy Mackay
cd999a2091
Location: initial class implementation
2016-04-30 10:33:01 +09:00
Ricardo de Almeida Gonzaga
60d141c717
missing: add cmath
2016-04-05 20:44:15 -07:00
Lucas De Marchi
d80a0e47bc
AP_Common: missing: move definitions to standard headers
...
This way we don't create problems regarding which header to include: we
just include the normal/c++11 headers and everything works as it should.
2016-02-16 19:49:09 -02:00
Lucas De Marchi
75d58bcfb6
Global: rename HAVE_NULLPTR_T with HAVE_STD_NULLPTR_T
...
This makes for a more standard name for these overrides.
2016-02-16 19:49:09 -02:00
Andrew Tridgell
29100937bc
AP_Common: allow for nullptr_t but not std::move replacement
2016-02-16 19:49:09 -02:00
Andrew Tridgell
52e36908ff
AP_Common: fixed std::move() for qurt build
...
Thanks Lucas!
2016-02-16 19:49:09 -02:00
Lucas De Marchi
e1ae79688d
AP_Common: add directory to add missing C/C++ symbols
...
Add a cstddef header to allow using std::nullptr_t with those toolchains
that don't provide it. The idea is to make these platforms to use our
wrapper header (see https://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html )
and then we add the missing bits to the header.
2016-02-16 19:49:08 -02: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
Gustavo Jose de Sousa
c2e3f05dbf
waf: ardupilotwaf: prefix build context methods with ap_
...
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa
3d22490397
waf: examples: use methods from bld instead of ardupilotwaf
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa
d281067bcc
waf: make example binaries be placed in 'examples' dir
...
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
2016-01-15 16:46:41 -02:00
Lucas De Marchi
a096703b06
Global: don't link with AP_Progmem
...
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02: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
Caio Marcelo de Oliveira Filho
6e7b73610d
waf: add waf support
2015-12-03 07:54:30 +11: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
6cf5e582b9
AP_Common: fixed examples build
2015-11-16 07:58:13 +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
2c38e31c93
Remove use of PSTR
...
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.
This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.
AVR-specific places were not changed.
2015-10-30 14:35:04 +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
Caio Marcelo de Oliveira Filho
4731f87683
AP_Common: add Makefile and clean up includes
2015-10-21 09:16:11 +11:00
Caio Marcelo de Oliveira Filho
ec52df991c
build: compile only the HAL files needed by the board
...
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho
2e464a53c2
AP_HAL: make code not depend on concrete HAL implementations
...
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.
A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.
The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.
Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.
The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +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
Gustavo Jose de Sousa
e32ad93ae3
AP_Common: standardize inclusion of libaries headers
...
This commit changes the way libraries headers are included in source files:
- If the header is in the same directory the source belongs to, so the
notation '#include ""' is used with the path relative to the directory
containing the source.
- If the header is outside the directory containing the source, then we use
the notation '#include <>' with the path relative to libraries folder.
Some of the advantages of such approach:
- Only one search path for libraries headers.
- OSs like Windows may have a better lookup time.
2015-08-11 16:28:42 +10:00
Lucas De Marchi
82314ee4a3
AP_Common: add helper macro ARRAY_SIZE
2015-07-06 10:07:21 +10:00
Andrew Tridgell
21c8a2d94a
AP_Common: override new and delete on all platforms to zero memory
...
this guarantees that all classes get zero initial members when
they are dynamically allocated.
2015-06-26 15:55:19 +10:00
Andrew Tridgell
191cdb8bc1
AP_Common: convert example from .pde to .cpp
2015-06-01 16:58:11 +10:00
Andrew Tridgell
a1a3212131
AP_Common: moved NOINLINE define to AP_Common.h
2015-05-21 09:35:26 +10:00
Andrew Tridgell
dd94cc18a1
AP_Common: fix for HAL_SITL rename
2015-05-05 09:45:55 +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
Randy Mackay
1475cf27ac
AP_Common: fix example sketch
2015-01-28 17:15:38 +09: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
9b81e46e61
AP_Common: add example sketch
2014-06-17 20:53:53 +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
Andrew Tridgell
77e8061170
AP_Common: added product ID for L3G4200D
2013-10-08 11:50:53 +11:00
Andrew Tridgell
86b58314c4
AP_Common: pack the RallyLocation structure
...
so it can be written as a single binary block
2013-10-03 12:21:08 +10:00
Michael Day
823a40c203
AP_Common: Added RallyLocation struct.
2013-10-03 12:21:08 +10:00
Andrew Tridgell
f1e120113c
AP_Common: added OPTIMIZE() macro
...
this can be used to change the compiler optimization level of
individual functions
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-10-03 12:21:07 +10:00
Andrew Tridgell
13cdc56a5a
AP_Common: removed SMACCM support
2013-09-26 22:38:31 +10:00
Andrew Tridgell
c1d56f74b5
AP_Common: change flymaple product ID to 0x100
...
keep it well away from the Invensense product IDs for the MPU6000
2013-09-24 13:51:28 +10:00
Mike McCauley
8f61a36e58
AP_Common: Flymaple compatibility
2013-09-24 13:33:25 +10:00
Andrew Tridgell
8b80beadc4
PX4: make FMUv2 identify itself differently
...
so we can tell which is which in logs
2013-09-09 18:04:40 +10:00
Andrew Tridgell
97b7130bb9
libraries: update license header to GPLv3
...
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell
933088b95a
AP_Common: fixed indent-tabs-mode
2013-05-30 09:52:38 +10:00
Andrew Tridgell
62b9a580e8
AP_Common: make PACKED depend on architecture
...
this will remove lots of warnings when building with arduino
2013-05-09 20:10:31 +10:00
Andrew Tridgell
3659b532be
AP_Common: added BIT_IS_SET() macro
...
makes bit mask testing safer on PX4
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-04-23 23:05:02 +10:00
Andrew Tridgell
4fe5ce8a09
AP_Common: added a define for PACKED
...
neater than a pragma
2013-04-20 13:52:36 +10:00
Jochen Tuchbreiter
c5f19f5df8
Plane: Implement issue 80: counterclockwise loiter
...
- libraries/AP_Common/AP_Common.h: Use bit 2 of Location.options to store
loiter direction
- ArduPlane/defines.h: New bitmask MASK_OPTIONS_LOITER_DIRECTION for struct
Location bit 2
- ArduPlane/ArduPlane.pde: New variable loiter_direction
- ArduPlane/GCS_Mavlink.pde: For mavlink loiter-commands use sign of param3 to
detemine direction. Set Location.option flag accordingly
- ArduPlane/commands.pde: Make sure loiter-directions get saved into EEPROM
correctly
- ArduPlane/commands_logic.pde: Set loiter_direction on all loiter-actions
as well as RTL/instant loiter
- ArduPlane/navigation.pde: Yield loiter_direction in update_loiter
2013-02-05 10:29:31 +11:00
Andrew Tridgell
cf5d102912
AP_Common: added board ID for PX4
2013-01-04 14:26:28 +11:00
James Bielman
a4af314b57
Add AP_HAL_SMACCM implementation.
...
- Add a board definition for SMACCMPilot.
- Support the SMACCM HAL in required utility libraries.
2013-01-03 13:48:06 -08:00
Andrew Tridgell
456e8bfb6e
AP_Common: include stdlib.h for abs()
2013-01-02 14:45:09 +11:00
Andrew Tridgell
ac8fcd5b23
AP_Common: include stdbool.h for ARM
2013-01-02 14:45:09 +11:00
Andrew Tridgell
57bf6531b4
Progmem: use right CONFIG_HAL_BOARD #ifdefs
2013-01-01 18:26:12 +11:00
Andrew Tridgell
3c0440b0b4
Math: use common degrees() and radians() functions
2012-12-20 14:53:22 +11:00
Pat Hickey
eb530b86e8
move Arduino.mk to /mk/Arduino.mk
2012-12-20 14:52:35 +11:00
Andrew Tridgell
28f0ce6185
Build: use -O0 for SITL
2012-12-20 14:52:33 +11:00
Andrew Tridgell
475496cee2
Revert "Arduino.mk: use target variables rather than recursive make for apm1, apm2.."
...
This reverts commit fcd58cc1d7892bb8b45db75c35e1bdccaa2d47bb.
still doesn't work ...
2012-12-20 14:52:33 +11:00
Andrew Tridgell
975506c840
Build: add debugging in SITL build
2012-12-20 14:52:33 +11:00
Pat Hickey
8fe3c5e5d6
Arduino.mk: use target variables rather than recursive make for apm1, apm2..
2012-12-20 14:52:31 +11:00
Andrew Tridgell
6a56f72918
Build: added empty Arduino.h
2012-12-20 14:52:30 +11:00
Andrew Tridgell
d473203737
Build: added global board targets
2012-12-20 14:52:30 +11:00
Pat Hickey
d93d932831
ArduCopter: defines fixes
...
Conflicts:
libraries/AP_Common/Arduino.mk
2012-12-20 14:52:28 +11:00
Andrew Tridgell
9b15d0e714
Build: update makefile for SITL build
2012-12-20 14:51:40 +11:00
Pat Hickey
da99f5f283
Arduino.mk: compile with CONFIG_HAL_BOARD define from the user's config.mk
2012-12-20 14:51:37 +11:00
Pat Hickey
fff4e87619
Arduino.mk: allow user avrdude flags
2012-12-20 14:51:36 +11:00
Pat Hickey
f490f2432d
Arduino.mk: norelax.inoflag will disable -Wl,--relax on a per sketch basis
...
* Some weird avr-ld bug that hits on 4.6.2 Fedora. Didn't have time to
investigate further.
2012-12-20 14:51:29 +11:00
Andrew Tridgell
3a2e138994
AP_Common: no c++ magic for PX4 build
2012-12-20 14:51:28 +11:00
Pat Hickey
a4f1f6a5db
AP_Progmem: fix dependencies for all sketches touched by AP_HAL_AVR
2012-12-20 14:51:28 +11:00
Pat Hickey
5c738810e2
AP_Progmem created: progmem macros per specific platform
...
* derived from AP_Common
2012-12-20 14:51:28 +11:00
Pat Hickey
a2f97ac7c7
AP_Common.cpp: Delete empty cpp file
2012-12-20 14:51:28 +11:00
Pat Hickey
f58935d1e7
AP_Common c++ lib: eliminate freeMemory and displayMemory
...
* also, no more error message in pure virtual call
2012-12-20 14:51:28 +11:00
Pat Hickey
9f9c183a4d
remove AP_Vector.h as deprecated
2012-12-20 14:51:28 +11:00
Pat Hickey
6a59ad143e
AP_Curve: made into its own library
2012-12-20 14:51:27 +11:00
Pat Hickey
f8047f158d
Arduino.mk: Changes to asm opts for compatibility with avr-gcc4.6
...
* Need to make sure these are compatible with older toolchains
before pushing to master
2012-12-20 14:51:26 +11:00
Pat Hickey
0d342a3293
AP_Common: use EXCLUDECORE macro to hack some debug messages away
2012-12-20 14:51:19 +11:00
Pat Hickey
7854c54880
Arduino.mk: when core is excluded, add -DEXCLUDECORE to flags
2012-12-20 14:51:19 +11:00
Pat Hickey
4493dbb4d2
Arduino.mk: support nocore.inoflag to do coreless builds of each sketch
2012-12-20 14:51:19 +11:00
Pat Hickey
b34d4cdb17
Remove empty AP_Var_menufuncs.cpp
2012-12-20 14:51:19 +11:00
Pat Hickey
3f1d9d7f69
AP_Param: #include <AP_Param.h> fixups for libraries & sketches
...
* I mostly went through with grep and added an #include <AP_Param.h> below
every #include <AP_Common.h>. Not all of these example sketches might
strictly need AP_Param.
2012-12-20 14:51:19 +11:00
Pat Hickey
c4dbe8c627
AP_Param: move from AP_Common to its own library
2012-12-20 14:51:19 +11:00
Pat Hickey
e82d1402ef
AP_Loop: moved to APO library, which is the only code that uses it
2012-12-20 14:51:19 +11:00
Andrew Tridgell
3c88b0d204
AP_Param: fixed Vector3f elements with 16 character names
2012-11-20 22:27:11 +11:00
Andrew Tridgell
b0713ba412
AP_Param: support up to 16 character parameter names
...
MAVLink allows for 16 chars, with no null termination if all 16 are
used
2012-11-20 21:35:22 +11:00
Andrew Tridgell
736cb4c34b
AP_Var: move the MetaClass lib into AP_Var
...
AP_Var is the only one that uses it, and it generates warnings in our
build if we leave it in AP_Common
2012-11-06 21:42:54 +11:00