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