On early versions of minlure an RGB LED was wrongly placed next to the
barometer, causing trouble on it.
Additionally depending on the LED intensity it may be a pain to leave it
turned on for boards supposed to be used for bench testing. This allows
to disable the LED by software so we don't have to remove it.
- got rid of a lot of not needed defines
- allocated channels on init instead of accessing them every time
through the HAL reference
- simpliefied hw_set_rgb()
<command-line>:0:18: warning: "HAL_BOARD_LINUX" is not defined [-Wundef]
../../libraries/AP_Notify/Buzzer.h:20:5: note: in expansion of macro ‘CONFIG_HAL_BOARD’
#if CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
^
In file included from ../../libraries/AP_Notify/Buzzer.cpp:18:0:
../../libraries/AP_Notify/Buzzer.h:20:25: warning: "HAL_BOARD_VRBRAIN" is not defined [-Wundef]
#if CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
^
Due to the way the headers are organized changing a single change in
an AP_Notify driver would trigger a rebuild for most of the files in
the project. Time could be saved by using ccache (since most of the
things didn't change) but we can do better, i.e. re-organize the headers
so we don't have to re-build everything.
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
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.
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.
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'.