Commit Graph

551 Commits

Author SHA1 Message Date
Andrew Tridgell bd2f548130 AP_HAL: allow argc and argc on QURT 2015-12-29 18:52:17 +11:00
Lucas De Marchi 97022a4161 AP_HAL: RingBuffer: fix macro expansion
Fix warning that reveals a real bug:

In file included from libraries/AP_HAL_Linux/UARTDriver.cpp:25:0:
libraries/AP_HAL_Linux/UARTDriver.cpp: In member function 'virtual bool Linux::UARTDriver::tx_pending()':
libraries/AP_HAL/utility/RingBuffer.h:21:35: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
 #define BUF_EMPTY(buf) buf##_head == buf##_tail
                                   ^
libraries/AP_HAL_Linux/UARTDriver.cpp:355:13: note: in expansion of macro 'BUF_EMPTY'
     return !BUF_EMPTY(_writebuf);

The problem is when there's a ! operator: without the parenthesis we would actually be doing

    return !_write_buf_head == _write_buf_tail

which is not what we want.
2015-12-28 21:50:27 -02:00
Andrew Tridgell c90d7dd86e AP_HAL: fixed vprintf segfault 2015-12-28 08:44:40 +11: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
Lucas De Marchi 520b0384fd AP_HAL: remove unused in_progmem flag to print_vprintf 2015-12-27 15:58:12 -02:00
Lucas De Marchi 8e0c125f56 AP_HAL: print_vprintf: follow coding style
- Use 4 spaces to indent
 - Add braces to control statements
 - Don't use tabs
2015-12-27 15:58:12 -02:00
Lucas De Marchi c35730058a AP_HAL: print_vprintf: stop using Progmem.h
Remove the unused support to data from progmem, including the unused %S
format specifier.
2015-12-27 15:58:12 -02:00
Lucas De Marchi 29ed01189d AP_HAL: ftoa_engine: replace tabs with spaces 2015-12-27 15:58:12 -02:00
Lucas De Marchi e751d632e6 AP_HAL: ftoa_engine: stop using Progmem.h 2015-12-27 15:58:12 -02:00
Andrew Tridgell 7c431b40f2 AP_HAL: enable HAL_QURT 2015-12-27 16:21:25 +11:00
Andrew Tridgell cfd54c5683 AP_HAL: moved dsm implementation into AP_HAL/utility 2015-12-27 16:12:27 +11:00
Andrew Tridgell fec9ffd1a0 AP_HAL: support UARTs on timer thread
This adds a macro for boards that need to have UARTs on the timer
thread instead of their own thread. This is needed for the qflight
port due to restrictions in the RPC API
2015-12-27 16:12:27 +11:00
Andrew Tridgell ac1e75ae77 AP_HAL: added qflight linux subtype 2015-12-27 16:12:27 +11:00
Julien BERAUD 0ffba07ec8 AP_HAL: Set default params for Bebop 2015-12-23 10:24:04 -02:00
Aaron Wang Shi c7a77af47f AP_HAL: add BH HAT board info 2015-12-21 15:54:30 +11:00
Andrew Tridgell 9d4b31ca3c AP_HAL: added a new_semaphore() interface to Util 2015-12-20 17:55:39 +11:00
Andrew Tridgell ec6a679482 AP_HAL: added ByteBuffer and ObjectBuffer in RingBuffer
much better API than old macros
2015-12-20 07:33:54 +11:00
Julien BERAUD eccef24fa7 AP_HAL: Add optical flow params for bebop
Params that are necessary for optical flow
2015-12-18 17:56:05 +11:00
Lucas De Marchi c7668479bb AP_HAL: follow coding style 2015-12-18 17:56:03 +11:00
Julien BERAUD 2b681f2f13 AP_HAL: Add support for an Optflow driver
This is meant to be used for onboard optical flow
2015-12-18 17:56:03 +11:00
Lucas De Marchi f69208d47d AP_HAL: remove state leftover from SPIDeviceDriver
This was previously used to allow to save a state in a SPIDriver so we
could synchronize the initialization of AP_Compass and
AP_InertialSensor.

It was only used by MPU9250 and is not used anymore since the move to
AuxiliaryBus initialization and it's not used anymore since c3dae6f
("AP_InertialSensor: MPU9250: Remove methods not used anymore")
2015-12-08 11:10:23 +11:00
Lucas De Marchi a1c3912bd8 AP_HAL: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:43 +11:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00
Lucas De Marchi 036eb21c09 AP_HAL: remove init() method with unused argument 2015-12-02 14:49:12 -02:00
Lucas De Marchi 6bc07da0ee AP_HAL: use init() method without arguments
Override the init() method from parent class that doesn't have a
parameter since it's not used here.
2015-12-02 14:42:37 -02:00
Lucas De Marchi 6b1c5e6f72 AP_HAL: add init() method without argument
The argument in init() is not used by any implementation. Add a second
method without it so the HAL implementation can used it instead. Later
the unused method will be removed.
2015-12-02 14:21:58 -02: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 44c280e9fb AP_HAL: fixed typo in do_transfer declaration 2015-12-01 07:18:10 +11:00
Julien BERAUD 88236821c0 AP_HAL_Linux: Adapt Heat_Pwm to use PWM_Sysfs
Only compiled on Bebop, the constructor will need to be modified to
pass the pwm chip number and to create a PWM_Sysfs instead of a PWM_Sysfs_Bebop
in case it is used on a mainline linux board
2015-12-01 07:07:26 +11:00
Julien BERAUD 0fa362ff5c AP_Notify: Fix GPIO declaration for Linux boards
Currently, the default behaviour on linux boards tries to
write LED gpios with fixed values among them. There is no way
to declare that there are no LED GPIOs.
This commit moves the declaration of the LED Gpios in AP_HAL_Boards.h
and makes AP_Notify do nothing if no LED gpio was declared
2015-12-01 07:07:26 +11:00
Julien BERAUD af6bbb806e AP_HAL: add do_transfer method to I2CDriver
Needed in linux HAL
2015-12-01 07:07:26 +11:00
Caio Marcelo de Oliveira Filho c5fc0deee9 AP_HAL_Scheduler: remove unused functions
Getting the time elapsed and panic are now functions in AP_HAL, so
remove them from HAL class interface and it's implementations.
2015-11-20 12:36:00 +09:00
Caio Marcelo de Oliveira Filho 5292bc0054 AP_HAL: example uses millis/micros/panic functions 2015-11-20 12:31:48 +09:00
Caio Marcelo de Oliveira Filho efbc7648b1 AP_HAL: create AP_HAL namespace and use for some HAL functionality
For certain basic functionality, there aren't much benefit to be able to
vary the implementation easily at runtime. So instead of using virtual
functions, use regular functions that are "resolved" at link time. The
implementation of such functions is provided per board/platform.

Examples of functions that fit this include: getting the current
time (since boot), panic'ing, getting system information, rebooting.

These functions are less likely to benefit from the indirection provided
by virtual interfaces. For more complex hardware access APIs the
indirection makes more sense and ease the testing (when we have it!).

The idea is that instead of calling

    hal.scheduler->panic("on the streets of london");

now use

    AP_HAL::panic("on the streets of london");

A less important side-effect is that call-site code gets
smaller. Currently the compiler needs to get the hal, get the scheduler
pointer, get the right function pointer in the vtable for that
scheduler. And the call must include an extra parameter ("this"). Now it
will be just a function call, with the address resolved at link time.

This patch introduces the first functions that will be in the namespace,
further patches will implementations for each board and then switch the
call-sites. The extra init() function allow any initial setup needed for
the functions to work.
2015-11-20 12:25:24 +09:00
Caio Marcelo de Oliveira Filho a348424551 AP_HAL: remove unused function
This was used by APM1/2 that were removed.
2015-11-18 11:50:56 +09:00
Andrew Tridgell 8f4ce7f20b build: removed all nocore.inoflag files
these were APM2 specific
2015-11-16 08:05:17 +11:00
José Roberto de Souza 6ece4d60aa AP_HAL: HAL_COMPASS_AK8963_MPU9250_I2C to the supported list 2015-11-11 14:29:07 +11:00
José Roberto de Souza b3f030f650 AP_HAL: Add MPU9250 over I2C 2015-11-11 14:29:07 +11:00
Andrew Tridgell 8a4c0593f2 AP_HAL: make available_memory() uint32_t 2015-11-05 16:09:00 +11:00
Víctor Mayoral Vilches 90a00553cb AP_HAL: Boards, add Erle-Brain 2 2015-11-04 13:58:24 +11:00
Lucas De Marchi 255e04a841 AP_HAL: remove check for AVR CPUs
Remove the checks for HAL_CPU_CLASS > HAL_CPU_CLASS_16 and
HAL_CPU_CLASS >= HAL_CPU_CLASS_75. Corresponding dead code will be
removed on separate commits.
2015-11-04 12:14:14 +11:00
Lucas De Marchi 3142f21363 AP_InertialSensor: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:12 +11:00
Lucas De Marchi 8e65e88d06 AP_HAL: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:11 +11:00
Lucas De Marchi 5244559010 Minimize AP_Progmem.h includes
Most of AP_Progmem is already gone so we can stop including it in most
of the places. The only places that need it are the ones using
pgm_read_*() APIs.

In some cases the header needed to be added in the .cpp since it was
removed from the .h to reduce scope. In those cases the headers were
also reordered.
2015-10-30 14:35:32 +09:00
Lucas De Marchi a65c98485c AP_HAL: UARTDriver: remove _P() variants
They aren't used anymore so remove.
2015-10-30 14:35:31 +09:00
Lucas De Marchi 1b07dabeb7 Replace prog_char and prog_char_t with char
prog_char and prog_char_t are now the same as char on supported
platforms. So, just change all places that use them and prefer char
instead.

AVR-specific places were not changed.
2015-10-30 14:35:30 +09:00
Lucas De Marchi 2556fc8dbe BetterStream: use common macro for printf formatting
Since this needs an additional header, also put them in correct order.
2015-10-30 14:35:26 +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 6f4904189b Replace use of println_P() with println() 2015-10-30 14:35:22 +09:00
Lucas De Marchi 831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Lucas De Marchi 0aa117f65d Replace use of strnlen_P() with strnlen() 2015-10-30 14:35:13 +09:00
Lucas De Marchi a8455aa4e3 AP_HAL: Remove Util::{v,}snprintf_P() 2015-10-30 14:35:06 +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 9eaf7c5660 AP_HAL: add format attribute to panic() 2015-10-24 14:26:36 +11:00
Lucas De Marchi 2322b8014d AP_HAL: use common macro for printf formatting 2015-10-24 14:26:36 +11:00
Lucas De Marchi ad61a93c14 AP_HAL: turn panic() into a variadic method
Change the declaration on all HAL implementations so panic() in future
may implement a printf-like interface.
2015-10-24 14:26:35 +11:00
Lucas De Marchi 0b4aa5ac85 AP_HAL: Scheduler: reorder includes
Follow the following order for includes:

   - Corresponding header file (if exists)
   - System headers
   - Other ArduPilot library headers
   - "Local" headers (from the same library)
2015-10-24 14:26:35 +11:00
Lucas De Marchi 79dee5aaa9 AP_HAL: fix warning due to missing prototype after HAL rework
This was introduced with the HAL rework:

In file included from /p/ardupilot/libraries/AP_HAL/AP_HAL.h:11:0,
                 from /p/ardupilot/ArduCopter/Copter.h:35,
                 from /p/ardupilot/ArduCopter/ArduCopter.cpp:76:
/p/ardupilot/ArduCopter/ArduCopter.cpp: In function 'int ArduPilot_main(int, char* const*)':
/p/ardupilot/libraries/AP_HAL/AP_HAL_Main.h:11:26: warning: no previous declaration for 'int ArduPilot_main(int, char* const*)' [-Wmissing-declarations]
 #define AP_MAIN __EXPORT ArduPilot_main
                          ^

It's due to PX4 using that warning as opposed to Linux. Since it harmless, add
the prototype for everybody.
2015-10-23 07:47:19 +11:00
Lucas De Marchi 8153f57f06 AP_HAL: add board definitions for minlure 2015-10-22 12:04:52 +11:00
Lucas De Marchi eef4d5819f AP_HAL: HAL: don't use relative includes
Includes in the same dir should not be relative. Also sort them
alphabetically.
2015-10-21 15:54:27 -02:00
Lucas De Marchi 74ccbdb6f7 AP_HAL: AnalogIn: add missing include
Since we are using uint8_t and uint16_t types we need to include the
correspondent system header. Otherwise it would depend on the include
order of who is including this particular header, causing failures as we
move headers around.
2015-10-21 15:54:27 -02:00
Caio Marcelo de Oliveira Filho b98bf2a65e AP_HAL: remove unnecessary includes from examples 2015-10-21 09:16:10 +11:00
Caio Marcelo de Oliveira Filho b29d6eff5d AP_HAL: add an AP_HAL_MAIN_CALLBACKS() macro
This is going to be used by vehicles that already have an object with
setup/loop functions. The vehicle object will just implement the
HAL::Callbacks interface.
2015-10-21 09:16:09 +11:00
Caio Marcelo de Oliveira Filho 19b4ca60c4 AP_HAL: provide AP_HAL_MAIN()
Move the macros to a single place and reduce the variations not based on
board, but based on

- The name of the entry-point function, specified by AP_MAIN;
- Whether it contains argc/argv arguments or not.

The goal here is that programs (vehicles and examples) don't need to
include all possible boards to define a main function. Further patches
will change the programs.
2015-10-21 09:16:09 +11:00
Caio Marcelo de Oliveira Filho 6fc60e2d5e AP_HAL: remove unused init() from the interface
And make run() pure virtual to ensure future implementations provide it.
2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho 72cd5ef185 AP_HAL: add run() method
Add run method, that encapsulate any mainloop logic on behalf of the
client code. The setup/loop functions are passed via a HAL::Callbacks
interface. The AP_HAL_MAIN() macro should be kept as trivial as
possible.

This interface should be implemented by the existing vehicle objects. To
make easy for the examples (that don't have the equivalent of vehicle
objects), a FunCallbacks was added to bridge to the functions directly.
2015-10-21 09:16:07 +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
Andrew Tridgell 28fa05c965 AP_HAL: added generic perf counter
simple wrapper around PX4 API, but ready for use by other HALs
2015-10-20 18:09:57 +11:00
José Roberto de Souza 6215a3d224 AP_HAL: Add MS5637 over I2C to the supported barometers list 2015-10-16 10:05:03 +11:00
Julien BERAUD f231182cd9 AP_HAL: Add support for a Heater
Add heater class and non-pure virtual method to Util class in order to do
nothing in case the function is not implemented
2015-10-06 15:21:39 +11:00
Lucas De Marchi fb643fbb53 AP_HAL: RCOutput: add methods to allow grouping writes 2015-10-06 10:42:18 +11:00
Lucas De Marchi 666dc3e440 AP_HAL: RCOutput: remove unused write method
This method is not used anymore since the introduction of channel map and
allowing motors to be enabled/disabled in AP_Motors.

Later we may introduce a method to write multiple values with a default
implementation that supports the channel and enable maps rather than
requiring all subclasses to implement this method.
2015-09-29 11:53:38 +09:00
mirkix f48bdc281f AP_HAL: Add support for using SPI devices of the same type. 2015-09-18 09:15:09 +10:00
Andrew Tridgell 582318448f AP_HAL: make new GPIO functions optional
not available on all boards
2015-09-14 14:22:16 +10:00
raspilot 6df83f46c5 AP_HAL: new GPIO APIs 2015-09-14 14:22:15 +10:00
raspilot dcc7cf2739 AP_HAL: raspilot board type 2015-09-14 14:22:15 +10:00
Víctor Mayoral Vilches b87fd58214 AP_HAL: ERLEBOARD legacy support
This config referred to the legacy Erle-Board
https://erlerobotics.com/blog/product/erle-board/
The configuration is preserved to support the
existing boards.
2015-09-09 10:31:55 +10:00
Gustavo Jose de Sousa e05928a7e8 AP_HAL: make SPIDeviceDriver::transaction() return success or failure 2015-09-01 20:26:05 +10:00
Lucas De Marchi a44ab9ed98 AP_HAL: define constant for HMC5843 on MPU6000 2015-08-28 12:39:09 +10:00
Andrew Tridgell e889886e07 AP_HAL: start with the vehicle disarmed
this prevents a race condition on startup that can cause a UAVCAN ESC
to run while the vehicle is booting
2015-08-23 09:49:52 +10:00
Lucas De Marchi ca17b6155e AP_HAL: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-18 17:12:51 +10:00
Andrew Tridgell c72372722e AP_HAL: fixed example builds 2015-08-11 17:00:03 +10:00
Gustavo Jose de Sousa 0456eccca8 AP_HAL: 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:43 +10:00
Randy Mackay 810973ce95 HAL: define capability bitmask 2015-07-31 14:50:19 +09:00
Andrew Tridgell eca0940bc7 AP_HAL: allow for broadcast packets on UDP IPv4 2015-07-29 16:46:33 +10:00
Andrew Tridgell 3e4b0b9869 AP_HAL: added pollout() function to socket API 2015-07-29 14:19:46 +10:00
Andrew Tridgell 596ecde70d AP_HAL: added listen and accept APIs to socket API 2015-07-29 09:07:41 +10:00
Andrew Tridgell b07f7e873f AP_HAL: added pollin() interface for Socket API 2015-07-29 08:58:02 +10:00
Andrew Tridgell 5067359ed7 AP_HAL: fixed socket destructor 2015-07-29 08:39:16 +10:00
Staroselskii Georgii 1a588263e4 AP_HAL: added destructor for Socket 2015-07-29 08:34:43 +10:00
Staroselskii Georgii 4411c1fed4 AP_HAL: improved constness of Socket API 2015-07-29 08:24:24 +10:00
Vladislav Zakharov 97b51a4bcb AP_HAL: Added deinit() method to RCInput
Add a deinit() counterpart. This is needed for some ports that require some deinitializtion logic. The default implementation is empty. I'm not sure whether we need to inforce it for all.
2015-07-23 08:51:37 +10:00
Lucas De Marchi b83708f77f AP_HAL: use ARRAY_SIZE macro 2015-07-21 14:24:56 +09:00
Andrew Tridgell 4e0c2c5a9b AP_HAL: defined default log and terrain directories for bebop
the /var filesystem is wiped on boot on Bebop. Use these as a
temporary workaround
2015-07-10 16:46:31 +10:00
Julien BERAUD f0bed711cf AP_HAL: added AK8963 I2C defines 2015-07-10 14:23:18 +10:00
Julien BERAUD e0b59942b0 AP_HAL: changed log directories for bebop 2015-07-10 14:23:18 +10:00
Julien BERAUD 5c414b4ca2 AP_HAL: Fix Compass I2C address for Bebop 2015-07-10 14:23:18 +10:00
Julien BERAUD 8d6123928f AP_HAL: Add i2c bus numbers and addresses 2015-07-10 14:23:18 +10:00
Julien BERAUD bef8001a09 AP_HAL: added MS5607 baro define 2015-07-10 14:23:17 +10:00
Julien BERAUD eea7ea8488 AP_HAL: split MPU6000 INS defines for I2C and SPI 2015-07-10 14:23:17 +10:00
Julien BERAUD 7275e33e79 AP_HAL: add the possibility to have more than 1 i2c
Bebop drone has 3 i2c
2015-07-10 14:23:17 +10:00
Andrew Tridgell a6f62c208e AP_HAL: added bebop Linux board type 2015-07-10 10:22:59 +10:00
Lucas De Marchi 384d650a23 AP_HAL: allow to have spi device state 2015-07-06 10:48:06 +10:00
Víctor Mayoral Vilches e5a90c7a34 AP_HAL: Util, add custom terrain and log methods 2015-06-30 14:36:00 +10:00
Gustavo Jose de Sousa 42eb73a1d1 AP_InertialSensor: add LSM9DS0 backend
This adds the backend driver for LSM9DS0. This implementation is based on the
legacy driver coded by Víctor Mayoral Vilches (under folder LSM9DS0) and makes
some necessary adaptations and fixes in order to work properly. The legacy
driver folder was removed.
2015-06-30 10:27:46 +10:00
Andrew Tridgell 7f239f5d46 AP_HAL: added get_shell_stream() 2015-06-17 17:04:15 +10:00
Eugene Shamaev 8cb367eaf8 AP_HAL: added rc_bind rcin method 2015-06-10 17:19:08 +10:00
Andrew Tridgell 979a571d68 AP_HAL: fixed example build 2015-06-10 09:27:41 +10:00
Andrew Tridgell c44ab01be8 AP_HAL: use noreturn attribute on panic
should reduce coverity warnings
2015-06-08 21:09:08 +10:00
Eugene Shamaev ca482cf44a StorageManager: added example sketch 2015-06-08 10:05:05 +09:00
Max Basescu de50217809 AP_HAL: Added RC_OUTPUT_MIN_PULSEWIDTH set to 400 and RC_OUTPUT_MAX_PULSEWIDTH set to 2100
For use in AP_HAL_AVR in RCOutput_APMx
2015-06-05 21:03:03 +10:00
Lucas De Marchi 1d39f548dc AP_HAL: remove aliases FUNCTOR_[BIND|TYPEF]_VOID
Nobody is using them anymore, so kill them.
2015-06-04 13:37:41 +09:00
Andrew Tridgell 5c86005160 AP_HAL: removed spurious delay example 2015-06-01 17:28:45 +10:00
Andrew Tridgell 1bd61ae96e AP_HAL: no need to include AP_Vehicle_Type.h here any more 2015-06-01 17:28:24 +10:00
Andrew Tridgell 36b19b26ce AP_HAL: convert example from .pde to .cpp 2015-06-01 17:03:40 +10:00
Andrew Tridgell 4dd47ead0e AP_HAL: removed old fastdelegate code 2015-06-01 15:18:30 +10:00
Andrew Tridgell ac3fc2f373 AP_HAL: fixed build warnings 2015-05-30 22:51:09 +10:00
Andrew Tridgell 4705be97bf AP_HAL: support %lld and %llu in internal printf
useful for log messages with 64 bit timestamps
2015-05-27 11:54:17 +10:00
Andrew Tridgell 1a2b02a563 AP_HAL: removed AVR special case
no longer needed
2015-05-26 14:34:13 +10:00
Lucas De Marchi 84f399ec3c APMrover2: Start using new Functor implementation
It both reduces flash size and move symbols to read-only sections.
The scheduler_tasks table is one known not to be in read-only section before due
to the FastDelegate implementation. Before and after this patch:

	APMrover2 $ size APMrover2.elf{.old,}
	   text	   data	    bss	    dec	    hex	filename
	 611406	   4832	  40920	 657158	  a0706	APMrover2.elf.old
	 609686	   4824	  38936	 653446	  9f886	APMrover2.elf

	APMrover2 $ nm -C APMrover2.elf{.old,} |grep tasks
	0000000000696f80 B Rover::scheduler_tasks
	000000000047c440 R Rover::scheduler_tasks

As can be seen above, now the scheduler_tasks symbol is in a read-only data
section and in all of them we decreased the total size.

For APM2 we have a similar situation, but the table was already in text section
because it was using plain C pointers:

	APMrover2 $ size APMrover2.elf{.old,}
	   text	   data	    bss	    dec	    hex	filename
	 189518	   1038	   3494	 194050	  2f602	APMrover2.elf.old
	 189216	   1038	   3480	 193734	  2f4c6	APMrover2.elf

	APMrover2 $ nm -C APMrover2.elf{.old,} |grep tasks
	00001f92 T Rover::scheduler_tasks
	00001f8a T Rover::scheduler_tasks
2015-05-26 13:46:55 +10:00
Lucas De Marchi 20ef7efaf6 AP_HAL: use functor macros
Functor is not yet being used but let's make is macro fallback to the
previous Delegate implementation for easy of transition between the two.
2015-05-26 13:46:55 +10:00
Lucas De Marchi 9f0af5b9cb AP_HAL: add fallback implementation of functor macros 2015-05-26 13:46:51 +10:00
Lucas De Marchi 83efb9280b AP_HAL: use variadic templates in FastDelegate
Now that we are using C++11 we can use variadic templates to simplify
the FastDelegate classes. It also simplifies moving away from the
FastDelegate implementation.
2015-05-26 13:46:51 +10:00
Lucas De Marchi 4b5cf24a81 Allow to change to functor implementation
Start to add code behind APM_BUILD_FUNCTOR to support changing the
functor implementation (without breaking the build while the change is
not complete).
2015-05-26 13:46:49 +10:00
Lucas De Marchi a1e1503e1a AP_HAL: Add Functor implementation
This is a Functor implementation that should cover the use cases we have
for FastDelegate. In contrary to the latter, it can be constructed at
compile time so the compiler can safely put it in a read-only section
which covers the cases in which we are not using it.
2015-05-26 13:46:49 +10:00
Andrew Tridgell 9336914598 AP_HAL: added sendto socket method 2015-05-22 16:07:44 +10:00
Andrew Tridgell d57fcf7e46 AP_HAL: added workaround for AVR delegates in PROGMEM 2015-05-21 07:48:45 +10:00
Andrew Tridgell be587beedc AP_HAL: disable nagle on sockets for faster local operation 2015-05-21 07:48:45 +10:00
Randy Mackay 0d72f3ac29 AP_HAL: fix example sketches 2015-05-12 14:42:15 +09:00
Andrew Tridgell 414f4125de AP_HAL: use FD_CLOEXEC to prevent sockets being inherited in SITL 2015-05-11 08:05:51 +10:00
Andrew Tridgell 692fc18698 AP_HAL: protect Socket.h from double include 2015-05-10 21:02:04 +10:00
Tom Pittenger 4b6d0d8e24 AP_HAL: replace fabs() with fabsf() 2015-05-09 09:57:26 +10:00
Andrew Tridgell 2369e06815 AP_HAL: fixed SITL build on windows 2015-05-06 09:07:03 +10:00
Andrew Tridgell 4c11002976 AP_HAL: added HAL_OS_SOCKETS define
used for systems with BSD sockets
2015-05-05 21:34:19 +10:00
Andrew Tridgell 08b9ed3342 AP_HAL: added socket handling class 2015-05-05 21:34:19 +10:00
Andrew Tridgell 35d22b9d57 AP_HAL: added getopt_cpp class
a simple port of getopt_long to C++
2015-05-05 09:45:58 +10:00
Andrew Tridgell 40e3b422b5 HAL_SITL: rename HAL_AVR_SITL to HAL_SITL
it is nothing to do with the original AVR emulation now
2015-05-05 09:45:54 +10:00
Andrew Tridgell df21c6c68d AP_HAL: support micros64() and millis64() on all platforms
this will allow for 64 bit timestamps in DF logs (Peter is working on
that)
2015-04-30 12:17:34 +10:00
Mikhail Avkhimenia 7ba6a5e346 AP_HAL: Specify terrain directory for Navio 2015-04-14 10:16:25 +10:00
Andrew Tridgell 55019abd71 AP_HAL: allow for default parameter override for PX4 and SITL 2015-04-04 09:01:40 -07:00
Andrew Tridgell b52918331a AP_HAL: make PXF use AK8963 compass by default 2015-03-13 18:46:15 +11:00
Andrew Tridgell d186b82edc AP_HAL: consolidate AK8963 defines 2015-03-13 18:46:15 +11:00
mirkix 4f1dd85e47 AP_HAL: Add test sketch for RC input to RC output pass through 2015-03-11 21:14:15 +09:00
Andrew Tridgell c63540f7b1 AP_HAL: added delay_microseconds_boost()
this will be used by wait_for_sample() to boost priority for a short
period at the end of each delay_microseconds()
2015-02-16 11:52:37 +11:00
Jonathan Challinger aa7776ea59 AP_HAL: add soft_armed state to hal.util 2015-02-11 20:25:10 +11:00
Grant Morphett 525787078f AP_HAL: 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 3075cb058d AP_HAL: changed semantics of RCInput.new_input()
this makes calling new_input() in RCInput clear the new input
flag. This fixes an issue with calls to read() for auxillary channels
clearing the new_input flag, which could cause brief failsafe
conditions.
2015-02-09 10:39:05 +11:00
Emile Castelnuovo a0673b56f9 AP_HAL: added new VRBRAIN boards and new subtypes 2015-02-02 08:43:58 +11:00
LukeMike edd0f13845 AP_HAL: mapped the different sizes of storage for all VR boards 2015-02-02 08:43:58 +11:00
Randy Mackay f84d31b838 HAL: fix example sketch 2015-01-28 17:15:40 +09:00
mirkix d11c5286c3 AP_HAL: HAL_COMPASS_AK8963 used but not defined anywhere 2015-01-22 14:35:51 +11:00
mirkix 7ceb93befa AP_HAL: make the examples usable with Linux 2015-01-22 14:30:47 +11:00
mirkix 70445d11f6 AP_HAL: add support for BBBMINI, simple ArduPilot DIY Cape for the BeagleBone Black 2015-01-12 21:36:40 +13:00
Andrew Tridgell 6fb00f4fc3 AP_HAL: create a common utility/RingBuffer.h header 2015-01-07 08:41:14 +11:00
Staroselskii Georgii a08a34f863 AP_HAL: changed default compass for Navio 2015-01-07 08:41:13 +11:00
Staroselskii Georgii e4a21f291d AP_HAL_Linux: added LinuxSPIUARTDriver that can handle SPI-driven Ublox 2015-01-07 08:41:12 +11:00
Andrew Tridgell 6993be54b7 HAL_Linux: raise storage size to 16k
match PX4 size
2015-01-03 14:06:54 +11:00
Andrew Tridgell 5aabfd4dc4 AP_HAL: added RCInput example sketch 2014-12-02 15:49:50 +11:00
Andrew Tridgell 8e36c1cd60 AP_HAL: fixed RCOutput example 2014-12-02 15:03:59 +11:00
Andrew Tridgell 4ec6a74829 AP_HAL: addex UART_test example sketch 2014-12-02 13:14:03 +11:00
Andrew Tridgell 9e0a7e6631 AP_HAL: fixed printf example build 2014-12-02 13:14:03 +11:00
Andrew Tridgell e89d380b73 AP_HAL: added set_esc_scaling() RCOutput function
this will be used to scale outputs for uavcan ESCs based on throttle
range
2014-11-26 11:14:44 +11:00
bugobliterator ad460659ad AP_HAL: make toneAlarm_init() return bool 2014-11-15 16:59:06 +11:00
Staroselskii Georgii bf860ee41f AP_HAL_Linux: Ublox SPI stub 2014-11-14 10:28:34 +11:00
Andrew Tridgell adcf994356 AP_HAL: added Zynq platform type 2014-11-14 10:21:04 +11:00
bugobliterator af203760bd HAL_Linux: change the return type of AP_HAL::Util::tonealarm_init() to signed int8_t.
This is a part of a set of fixes for the bugs and typos tridge discovered and shared inside earlier commits for setting up tonealarm.
2014-11-10 06:27:48 +11:00
bugobliterator fa6e83318d AP_HAL: Add virtual toneAlarm member functions to be declared under Linux_HAL 2014-11-10 06:27:48 +11:00
Randy Mackay 033b14db16 AP_HAL: add force_safety_on method 2014-09-18 09:58:44 +09:00
Emile Castelnuovo 7a70c0132d AP_HAL: VRBRAIN corrected EEPROM size and added terrain folder on MicroSD 2014-08-31 10:56:56 +09:00
Andrew Tridgell 7439d34a5d AP_HAL: add millis64() and micros64() on faster boards
this can be used for much simpler scheduling, without any wrap
handling
2014-08-20 07:55:19 +10:00
Andrew Tridgell b40bd479c4 HAL_Linux: moved FRAM vs FS choice into HAL_Linux headers 2014-08-19 10:08:17 +10:00
Andrew Tridgell 226b67d357 AP_HAL: make PXf default to MPU9250 2014-08-19 10:08:16 +10:00
bugobliterator 072c39ea6a AP_HAL: Add option to select Storage type AP_HAL_Boards.h
user can set HAL_STORAGE as USE_FS or USE_FRAM inside AP_HAL_Boards.h as per his/her choice or board setup
2014-08-19 10:08:16 +10:00
Víctor Mayoral Vilches 37793cd7fa AP_HAL_Namespace: Change LSM9DS0 into two different devices. 2014-08-19 10:08:15 +10:00
Víctor Mayoral Vilches e272ed8d96 AP_HAL: Add support for L3GD20 2014-08-19 10:08:15 +10:00
Víctor Mayoral Vilches 82186a3961 HAL: Add two new SPI devices
SPIDevice_LSM303D and SPIDevice_L3GD20 added to the enum.
The code has also been formated.
2014-08-19 10:08:15 +10:00
Emile Castelnuovo 0d62b15292 AP_HAL: added missing CONFIG_HAL_BOARD_SUBTYPE #define for HAL_BOARD_VRBRAIN 2014-08-16 20:28:57 +10:00
Andrew Tridgell b61ecb47af AP_HAL: fixed example build 2014-08-13 22:11:46 +10:00
Andrew Tridgell 5cca163b1f AP_HAL: fixed example build 2014-08-13 21:48:35 +10:00
Andrew Tridgell e34463a4bb AP_HAL: flymaple build fix 2014-08-13 18:46:44 +10:00
Andrew Tridgell d40d0f6aec AP_HAL: removed old storage type read/write functions
not needed any more
2014-08-13 18:46:44 +10:00
Andrew Tridgell f748e07ecf AP_HAL: ensure we have subtypes for all boards 2014-08-13 18:46:43 +10:00
Mikhail Avkhimenia 784533e9c8 AP_HAL: add configuration for HAL_BOARD_SUBTYPE_LINUX_NAVIO 2014-08-12 22:09:17 +10:00
Andrew Tridgell 02dec5634f AP_HAL: fixed example builds 2014-07-25 17:52:01 +10:00
Andrew Tridgell 63b5811a7c AP_HAL: added HAL_BOARD_TERRAIN_DIRECTORY 2014-07-24 21:45:56 +10:00
Andrew Tridgell 9b23921626 AP_HAL: added LSM9DSO_G SPI device 2014-07-19 13:22:24 +10:00
Markus Koetter 1edf7ef05f AP_HAL: use VRBRAIN INS/BARO/COMPASS for VRBRAIN boards 2014-07-15 11:43:00 +10:00
Andrew Tridgell 7195e38585 AP_HAL: fixed I2C build on APM2 2014-07-14 09:44:35 +10:00
Andrew Tridgell 5693392838 AP_HAL: added the concept of a board subtype, and default sensor types
this will make the vehicle code much more generic
2014-07-14 09:44:34 +10:00
Víctor Mayoral Vilches c4b6026d53 HAL_Linux: include readRegistersMultiple in I2CDriver
AP_HAL_Linux implemments this new method.
2014-07-14 09:28:42 +10:00
Víctor Mayoral Vilches 57ec305caa AP_HAL: Fixes to make the ERLE layer work 2014-07-14 09:10:23 +10:00
Víctor Mayoral Vilches 8af1b6faa7 AP_HAL_Linux: Add support for SPIDevice_LSM9DS0
The LSM9DS0 SPI device is connected to
SPI0, thereby SPIDriver class should return the
corresponding device.
2014-07-14 09:10:23 +10:00
Víctor Mayoral Vilches 5493be1b0d AP_HAL: Add SPIDevice_MPU9250 as a device. 2014-07-14 09:02:46 +10:00
Andrew Tridgell 74ee70d463 HAL_Linux: updates for ERLE board type 2014-07-14 08:52:27 +10:00
Andrew Tridgell 18a64d17d3 AP_HAL: added HAL_ prefix to GPIO_ defines
this fixes a bug caused by GPIO_INPUT and GPIO_OUTPUT already being
defined in NuttX, which caused pinMode() not to setup pins for output
when requested
2014-06-02 09:24:52 +10:00
Andrew Tridgell 74227cd7f0 AP_HAL: prevent some FastDelegate warnings 2014-05-08 11:11:03 +10:00
Andrew Tridgell 5cd145a307 AP_HAL: added set_failsafe_pwm() API
this allows the PWM values for FMU firmware failure to be setup
2014-04-21 08:36:52 +10:00
Emile Castelnuovo 201332caef AP_HAL: New VRBRAIN board definition and libraries 2014-04-08 16:19:19 +10:00
Andrew Tridgell 6eee2421cc AP_HAL: removed RCInput valid_channels() and added new_input() and num_channels()
the valid_channels() method was inconsistently implemented between
boards, and served two quite different purposes. It is clearer as two
functions
2014-03-25 14:39:41 +11:00
Andrew Tridgell d36989f6a1 AP_HAL: fixed example build 2014-03-19 12:14:06 +09:00
Randy Mackay 7663c5898e AP_HAL_Boards: board specific storage size definition 2014-03-19 12:11:52 +09:00
Andrew Tridgell 3fa2207a2d AP_HAL: allow for microsecond resolution in scheduler->stop_clock()
this makes 400Hz in the replay code possible
2014-02-26 19:33:39 +11:00
Andrew Tridgell 4cb61f1f08 AP_HAL: support uartE 2014-02-26 08:18:20 +11:00
Andrew Tridgell 735c6449a1 AP_HAL: added support for commandline arguments
useful for log replay, specifying log file
2014-02-23 08:15:39 +11:00
Andrew Tridgell 9cf70fe3f7 AP_HAL: another broken example build
this one an internal compiler error
2014-02-17 12:42:13 +11:00
Andrew Tridgell 830afefcef AP_HAL: fixed example build 2014-02-15 06:40:29 +11:00
Andrew Tridgell 117b77460e HAL_Linux: added stop_clock hack! 2014-02-15 05:28:08 +11:00
Andrew Tridgell bea0a46410 AP_HAL: added servorail_voltage and power_status_flags() API on AnalogIn 2014-02-15 05:00:09 +11:00
Andrew Tridgell 7c1b9b344f AP_HAL: added get_flow_control() API 2014-02-14 21:51:00 +11:00
Andrew Tridgell 1849db7074 AP_HAL: added board_voltage AnalogIn method
this makes it easier to get the board voltage from any library,
without having to allocate another analog channel object
2014-02-14 21:25:38 +11:00
Andrew Tridgell ccb7dc640d AP_HAL: fixed a build warning 2014-02-12 10:51:58 +11:00
Andrew Tridgell 439a075b30 AP_HAL: added force_safety_off rcoutput function
this forces the safety switch off, enabling PWM on the IO board
2014-02-11 15:58:25 +11:00
Andrew Tridgell c5c1d1358a HAL_PX4: added automatic hardware flow control detection
this allows us to detect if hardware flow control is not available and
automatically disable it
2014-02-11 12:11:26 +11:00
Andrew Tridgell 3e637ac5d9 AP_HAL: added enable_flow_control() option in AP_HAL 2014-02-10 12:54:50 +11:00
Andrew Tridgell 87cc95dd7f AP_HAL: removed unused enable_mask and disable_mask functions 2014-01-16 17:16:17 +11:00
Andrew Tridgell 5e39b6fb11 AP_HAL: added set_safety_pwm() API 2014-01-15 22:25:22 +11:00
Andrew Tridgell ea649e036b AP_HAL: added HAL_CPU_CLASS define for selecting algorithms
this will make it easier to select the appropiate level of algorithm
for a CPU
2013-12-31 10:28:37 +11:00
Andrew Tridgell 7e1e10f941 AP_HAL: added time_shift() scheduler API
used for log replay
2013-12-30 14:35:09 +11:00
Andrew Tridgell 172398a971 AP_HAL: added available_memory() interface 2013-12-28 14:51:01 +11:00
Andrew Tridgell e321ad65f4 AP_HAL: fixed example build 2013-12-17 11:51:37 +11:00
Andrew Tridgell f95bea699b AP_HAL: added get_system_id() method on Util 2013-11-26 13:00:03 +11:00
Andrew Tridgell cbc0f3ec27 AP_HAL: support uartD on some boards
PX4 and SITL get an extra UART
2013-11-23 19:29:22 +11:00
Andrew Tridgell 0ca82d5e3c AP_HAL: added set_system_clock() API 2013-10-24 14:22:48 +11:00
Randy Mackay 443023bbbf AP_HAL: add ignore_errors to I2C driver 2013-10-21 20:01:32 +09:00
Andrew Tridgell 7ef187fcfd AP_HAL: added optional set_timer_speed() scheduler API
will be used by copter to reduce interrupt load on APM2
2013-10-13 11:03:35 +09:00
Andrew Tridgell 5ccf8409b4 AP_HAL: added an optional spi.set_bus_speed() API
this will be used by MPU6000 on APM2 to change speed after init
2013-10-13 11:03:04 +09:00
Andrew Tridgell 9f24c45502 AP_HAL: removed separate Console class
the idea of a separate console class was never really used, and just
added confusion in a HAL port. It also consumes some much needed ram
and flash space on APM2
2013-10-05 18:32:00 +10:00
Andrew Tridgell 34a328f66d AP_HAL: added safety_switch_state() function in hal.util
will be used by copter to check safety switch is set
2013-10-05 15:46:35 +10:00
Andrew Tridgell efe1e01700 AP_HAL: require a buffer write() function in all ports
this makes a sufficient performance difference that it is worth it
2013-10-03 12:21:07 +10:00
Andrew Tridgell f2de4bb7b0 AP_HAL: implement AP_HAL::MemberProc via FastDelegate.h
this provides a more portable way to encapsulate member functions in
variables
2013-09-30 20:51:13 +10:00
Andrew Tridgell f0f5761e8d AP_HAL: make timed processes take void *argument
this allows the class to be passed in, meaning that drivers that use
register_timer_process() and register_io_process() don't need to use
static members. That results in simpler, easier to read code
2013-09-28 21:24:02 +10:00
Andrew Tridgell 296417a228 AP_HAL: added AP_HAL_LINUX define 2013-09-28 21:24:01 +10:00
Andrew Tridgell 60f3a8b6cf AP_HAL: removed SMACCM support 2013-09-26 22:38:31 +10:00
Mike McCauley ec5425578e AP_HAL: Added Flymaple board 2013-09-24 13:33:25 +10:00
Andrew Tridgell 0e9aef7e52 AP_HAL: changed base defines for print()
this avoids a conflict with wirish from libmaple
2013-09-23 18:10:21 +10:00
Andrew Tridgell 87bb3bc5dc AP_HAL: added AP_HAL_PX4 define 2013-09-22 16:02:42 +10:00
Andrew Tridgell 928e06f52c AP_HAL: use fabs() in print
fixes build on Arduino
2013-09-22 13:18:40 +10:00
Andrew Tridgell d46f5f6943 AP_HAL: implement betterstream functions in AP_HAL
this gives more consistancy between ports
2013-09-22 12:20:59 +10:00
Andrew Tridgell 0d662c52b3 AP_HAL: fixed length return from snprintf 2013-09-21 15:45:05 +10:00
Andrew Tridgell 0063f1fad8 AP_HAL: added Util.cpp
common printf functions
2013-09-21 14:25:42 +10:00
Andrew Tridgell 85b3f0d18d AP_HAL: expanded printf test suite 2013-09-21 13:29:52 +10:00
Andrew Tridgell 60122f9877 AP_HAL: moved printf implementation from AP_HAL_AVR to AP_HAL
this gives a common printf implementation on all boards, which
simplifies testing, and also simplifies porting to new boards
2013-09-21 13:28:46 +10:00
Andrew Tridgell 4ad4b60fbc HAL: added Printf test sketch
for testing new non-asm printf code
2013-09-21 11:16:08 +10:00
Andrew Tridgell a5b29f44d5 AP_HAL: added hal.gpio->usb_connected() function
this replaces the USB_MUX_PIN on APM2, and works on PX4 and FMUv2
2013-09-19 16:23:40 +10:00
Andrew Tridgell a587b1140a AP_HAL: added voltage_latest() interface
this will be used for reading the 5V rail
2013-09-12 13:23:04 +10:00
Andrew Tridgell 7082e0f8aa AP_HAL: added hold_in_bootloader parameter to scheduler->reboot() 2013-09-04 11:58:13 +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
Randy Mackay ac36a09747 AP_HAL: add toggle to GPIO 2013-08-30 13:01:34 +10:00
Andrew Tridgell ef5a42fabc AP_HAL: added RCOutput example sketch
useful for testing all 14 channels via APM API
2013-08-30 13:01:32 +10:00