Commit Graph

709 Commits

Author SHA1 Message Date
Martin Evans 6f6112d7c2 AP_HAL_Linux: Add setting for GPIO for Dark board
Just like other RPI-based boards.
2016-10-24 10:00:24 -02:00
Martin Evans d2d3119b66 AP_HAL_Linux: PCA9685: Add quinary address 2016-10-24 10:00:06 -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
Julien Beraud 20dcd6e082 RCOutput_Bebop: fix motor order
Accidentally pushed in commit 298f7bffb9
The order of the motors shouldn't have been changed on version 5 because
it is specific to older versions of the ESC controller firmware
2016-10-17 20:55:49 +11:00
Andrew Tridgell 33bff3c79c HAL_Linux: fixed transmitter failsafe with SBUS RCInput 2016-10-17 06:53:33 +11:00
Andrew Tridgell 110355f14e HAL_Linux: fixed SRXL and DSM
fixed default decoder state and fixed mic-recognition of SRXL as DSM
2016-10-16 21:31:37 +11:00
Andrew Tridgell e9633553fb HAL_Linux: update for changed SRXL API 2016-10-16 19:05:19 +11:00
Andrew Tridgell 03f9496549 HAL_Linux: lock onto a single decoder on the 115200 port 2016-10-16 19:05:19 +11:00
Andrew Tridgell 513156a4cc HAL_Linux: make 115200 R/C decoders return a bool 2016-10-16 19:05:19 +11:00
Andrew Tridgell 710d08da6d HAL_Linux: support SRXL R/C input 2016-10-16 19:05:19 +11:00
Andrew Tridgell 7f09d20e3b HAL_Linux: implement cork and push for remaining RCOutput backends 2016-10-13 10:00:04 +11:00
Andrew Tridgell c8179a0887 HAL_Linux: implement cork/push for RCOutput_AioPRU 2016-10-13 10:00:04 +11:00
Andrew Tridgell 0640b6539c HAL_Linux: implement cork()/push() for Raspilot 2016-10-13 10:00:04 +11:00
Andrew Tridgell a80eea5de4 HAL_Linux: implement cork()/push() for HAL_Linux RCOutput_Sysfs 2016-10-13 10:00:04 +11:00
Andrew Tridgell 0cd3054a4c HAL_Linux: document the Disco PWM pinout 2016-10-12 21:41:49 +11: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
Andrew Tridgell 3eb8b5e99f HAL_Linux: added RCInput_Multi
this allows for multiple RCInput methods on one board. On Disco it
combines RCInput_115200 with RCInput_SBUS
2016-09-21 10:33:15 -03:00
Andrew Tridgell 5909552f67 HAL_Linux: added RCInput_115200
this is a RCInput module for multiple R/C uart protocols running at
115200 baud 8-bit. We can decode multiple protocols in parallel with
this module, relying on frame timing and CRCs to get the right
protocol
2016-09-21 10:33:15 -03:00
Andrew Tridgell e913b9a8f7 HAL_Linux: fixed incorrect include 2016-09-21 10:33:15 -03:00
Andrew Tridgell a4c1bc3fd3 HAL_Linux: avoiding setting the SPI mode on every transfer
This was causing the Disco kernel to print a debug message on every
SPI transfer, which makes for a very noisy kernel and large kernel logs
2016-09-17 00:35:00 -03:00
William Liu b1a62d6c8e AP_HAL_Linux: RCOutput_Bebop: fixed potential deadlock 2016-09-09 09:59:17 -07:00
Gustavo Jose de Sousa 025082b280 AP_HAL_Linux: add port to Intel Aero
Contributions from:
 - Gustavo Jose de Sousa <gustavo.sousa@intel.com>
 - José Roberto de Souza <jose.souza@intel.com>
 - Lucas De Marchi <lucas.demarchi@intel.com>
 - Patrick J.P <patrick.pereira@intel.com>
2016-09-03 01:03:07 -03:00
Patrick J.P c32dc3bc37 AP_HAL_Linux: Add AeroIO communication module
Signed-off-by: Patrick J.P <patrick.pereira@intel.com>
2016-09-03 01:03:07 -03:00
Ralf Ramsauer 71212942da AP_HAL: AP_HAL_Linux: align I2CDevice::read_registers_multiple()
25c7e8b changed the logic of transfer(). Align
I2CDevice::read_registers_multiple() in the same way.

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@othr.de>
2016-08-31 00:18:50 -03:00
Ralf Ramsauer 5b81920737 AP_HAL: AP_HAL_Linux: add comment to I2CDevice::transfer()
If I2CDevice::transfer() has to do nothing it returns false. This can be
misleading, as this might feel contradictory.

Let's spend a comment on that.

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@othr.de>
2016-08-29 15:20:14 -03:00
Ralf Ramsauer 25c7e8bf60 AP_HAL: AP_HAL_Linux: perfect I2CDevice::transfer()
According to man 3 ioctl, ioctl returns other values than -1 on success.
So loop while ioctl returns -1.

Furthermore, there is no necessity to initialise r with -EINVAL,

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@othr.de>
2016-08-29 15:20:14 -03:00
Lucas De Marchi 833f565f09 AP_HAL_Linux: prefix threads with ap
This makes it consistent with bus threads and easier to grep from a `ps`
call.
2016-08-29 10:27:36 -03:00
Lucas De Marchi e1ab44f4a3 Global: remove get_fd() from Device API
This was there for compatibility with I2CDriver and SPIDriver. We don't
use them anymore so we can remove the compat method.
2016-08-29 10:27:36 -03:00
Murilo Belluzzo 077e03678f Global: Adapt Stream class to be used with Ringbuffer 2016-08-03 01:44:02 -03:00
Lucas De Marchi 8541d5339d AP_HAL_Linux: Implement threaded SPI 2016-07-30 00:55:27 -03:00
Lucas De Marchi ea0595c7ac AP_HAL_Linux: SPIDevice: move implementation to outside
As we add methods, it's becoming too complex to be implemented together
with the declaration.
2016-07-30 00:55:27 -03:00
Lucas De Marchi 590539f674 AP_HAL_Linux: implement threaded I2C 2016-07-30 00:55:27 -03:00
Lucas De Marchi 11ddbb8fb8 AP_HAL_Linux: add PollerThread
This is the infrastructure needed by both SPIDevice and I2CDevice to
start a poller thread per bus.
2016-07-30 00:55:27 -03:00
Lucas De Marchi 7d451ac876 AP_HAL_Linux: allow to check if thread is running 2016-07-30 00:55:27 -03:00
Lucas De Marchi eca6f45b68 AP_HAL_Linux: remove unused part of Poller infra
We aren't going to use all the poller infra for now and we need it's
behavior a little bit different for what we are going to use:

    - Do not use any "fair" time for each ready fd since we don't want
      to set a timeout
    - Allow to set the fd on Pollable after constructing it since we are
      likely to embed Pollable inside other structs and just later be
      able to open an fd.
    - Let caller use the epoll flags directly - this is not in AP_HAL,
      so there's no need to abstract them
2016-07-30 00:55:27 -03: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
Lucas De Marchi eaa1c39a15 AP_HAL_Linux: update Device interface 2016-07-30 00:55:27 -03:00
Lucas De Marchi 8e5aba8653 AP_HAL_Linux: I2CDevice: move implementation to outside
As we add methods, it's becoming too complex to be implemented together
with the declaration.
2016-07-30 00:55:27 -03:00
Lucas De Marchi 7b39f3d0a7 AP_HAL_Linux: do not warn for empty table
../../libraries/AP_HAL_Linux/SPIDevice.cpp: In member function ‘virtual AP_HAL::OwnPtr<AP_HAL::SPIDevice> Linux::SPIDeviceManager::get_device(const char*)’:
../../libraries/AP_HAL_Linux/SPIDevice.cpp:337:27: warning: comparison is always false due to limited range of data type [-Wtype-limits]
     for (uint8_t i = 0; i < _n_device_desc; i++) {
                         ~~^~~~~~~~~~~~~~~~

Define a dummy device to remove warning.
2016-07-30 00:03:23 -03:00
Lucas De Marchi f37a560295 AP_HAL_Linux: remove private headers
This centralized private header encourages centralizing things on
umbrella headers that are a pain to maintain. Force each part of
AP_HAL_Linux to include what is used.
2016-07-29 20:29:46 -03:00
Lucas De Marchi e8f71a5bd2 AP_HAL_Linux: change define and members visibility
Make some member variables protected to follow what we do in other
places (and there's no reason to be private).

Move defines to .cpp to reduce their visibility.
2016-07-29 20:27:12 -03:00
Lucas De Marchi f36e8d9c05 AP_HAL_Linux: remove AP_HAL_Linux_Namespace header
This centralized namespace header encourages centralizing things on
umbrella headers that are a pain to maintain. Force each part of
AP_HAL_Linux to include what is used.

While at it, do some whitespace cleanups and minor changes to adhere to
coding style.
2016-07-29 20:25:03 -03:00
Lucas De Marchi b044fac4b6 AP_HAL_Linux: rename variable to follow I2CDevice convention 2016-07-29 15:01:15 -03:00
Lucas De Marchi 7b140da6d1 AP_HAL_Linux: remove SPIDriver
SPIDevice now controls all accesses to SPI bus.
2016-07-29 15:01:15 -03:00
Lucas De Marchi 945556bbc3 AP_HAL_Linux: remove id for SPIDevice_Ublox and RASPIO 2016-07-29 15:01:15 -03:00
Lucas De Marchi 065592e7df AP_HAL_Linux: SPIUARTDriver: add some cosmetic changes
Mainly changes to follow the coding style and reduce the complexity a
little bit.
2016-07-29 15:01:15 -03:00
Lucas De Marchi e3c0476b8a AP_HAL_Linux: SPIUARTDriver: initialize device once 2016-07-29 15:01:14 -03:00
Lucas De Marchi 418cc817a3 AP_HAL_Linux: SPIUARTDriver: fix conversion to SPIDevice
We need to use the fullduplex method to transfer both tx and rx at the
same time.
2016-07-29 15:01:14 -03:00
Lucas De Marchi cbbd6f9d78 AP_HAL_Linux: SPIDevice: implement fullduplex transfer 2016-07-29 15:01:14 -03:00
Luiz Ywata 7ded01cf24 AP_HAL_Linux: SPIUARTDriver: use SPIDevice interface 2016-07-29 15:01:14 -03:00
Luiz Ywata c8bb5e6469 AP_HAL_Linux: RCInput_Raspilot use SPIDevice interface 2016-07-29 15:01:14 -03:00
Luiz Ywata e8d3229492 AP_HAL_Linux: RPIOUARTDriver: use SPIDevice interface 2016-07-29 15:01:14 -03:00
Luiz Ywata bfd840c5ca AP_HAL_Linux: RCOutput_Raspilot: use SPIDevice interface 2016-07-29 15:01:14 -03:00
Lucas De Marchi 86ac9bc367 AP_HAL_Linux: AnalogIn_Raspilot: use SPIDevice interface 2016-07-29 14:47:04 -03:00
Lucas De Marchi 8681d23cbd AP_HAL_Linux: remove unused Dataflash
This is selectable by a define and is never changed. Just remove
everything referencing it: we can come up with a better solution if it
is actually used later.
2016-07-29 14:47:04 -03:00
Lucas De Marchi 73bb371918 AP_HAL_Linux: remove I2CDriver
I2CDevice now serves for the same purpose.
2016-07-28 18:08:56 -03:00
Lucas De Marchi 84f45f09a3 AP_HAL_Linux: convert CameraSensor_Mt9v117 to I2CDevice 2016-07-28 18:03:09 -03:00
Lucas De Marchi 9acffc8868 AP_HAL_Linux: use Empty version if not implemented
There's little point in having the Linux::AnalogIn just to implement and
empty interface. All implementations inside AP_HAL_Linux are already
inheriting directly from AP_HAL, so just remove it.
2016-07-28 16:42:38 -03:00
Lucas De Marchi 47d2f8dc6d AP_HAL_Linux: AnalogIn_ADS1115: return 5V on board_voltage
board voltage is not available - don't return 0V since that prevents
arming.
2016-07-28 16:42:38 -03:00
Staroselskii Georgii 4ca1b58408 AP_HAL_Linux: add ConsoleDevice a handler for TTIN signal
In a case ArduPilot is launched as a background process without
detaching with *nohup* like this ./arduplane -C /dev/ttyAMA0 ConsoleDevice
is created and an attempt to read from it is made. This yields in a stopped
process. This is an endeavour to overcome this problem.
2016-07-27 21:30:19 +10:00
Staroselskii Georgii 8d2b587f71 AP_HAL_Linux: RPI: set signal handler iff nobody has already done it before 2016-07-27 21:30:19 +10:00
Staroselskii Georgii 5e8edcb1db AP_HAL_Linux: use NSIG instead of a hardcoded number in RCInput_RPI 2016-07-27 21:30:19 +10:00
hiro2233 3ae36c4a6c AP_HAL_Linux:RCInput: Minimun input channels defined 2016-07-27 00:55:55 -03:00
Lucas De Marchi cfb3124f2c AP_HAL_Linux: remove types for spi drivers
Those drivers using SPIDevice interface don't need a global id for each
of them. Remove those that were already converted.
2016-07-21 16:05:03 -03:00
Lucas De Marchi b23f7a8be4 AP_HAL_Linux: examples: remove BusTest
This needs to be rewritten using the probe methods.
2016-07-21 16:05:03 -03:00
Andrew Tridgell 96095b0942 HAL_Linux: fixed comment typo for SBUS input 2016-07-20 13:38:17 +10:00
Andrew Tridgell b69170febd HAL_Linux: fixed build for Disco with I2C changes 2016-07-20 13:38:17 +10:00
Andrew Tridgell f5a20d28bc HAL_Linux: fixed comment in SBUS 2016-07-20 13:38:17 +10:00
Andrew Tridgell a78b875ec3 HAL_Linux: fixed ULTRASOUND GPIO for Disco 2016-07-20 13:38:17 +10:00
Andrew Tridgell 1d8e4cdea9 HAL_Linux: added debugging line for Heat_Pwm 2016-07-20 13:38:17 +10:00
Andrew Tridgell 55d692708b HAL_Linux: fixed set_esc_scaling on Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell 298f7bffb9 HAL_Linux: fixed motor output for Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell 9b057ee4f1 HAL_Linux: separate out the GPIO table for Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell 677a38a10a HAL_Linux: make SBUS input much more robust
use inter-frame gap to resync after byte loss
2016-07-20 13:38:16 +10:00
Andrew Tridgell 29135a0158 HAL_Linux: use termios2 for SBUS RCOUT on Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell a40d704126 HAL_Linux: added RCOutput_Disco
combines Sysfs and Bebop RCOutput code
2016-07-20 13:38:16 +10:00
Andrew Tridgell cf83a43b56 HAL_Linux: support SBUS input on Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell aaaa6d38c7 HAL_Linux: initial support for Disco 2016-07-20 13:35:51 +10:00
Staroselskii Georgii a1f151a79b AP_HAL_Linux: do not create unnecessary consoles in UARTDriver 2016-07-15 15:31:19 -03:00
Staroselskii Georgii 7b3a5e3158 AP_HAL_Linux: use factory method for creation of UARTDriver backends
Using factory method maked it easier to grasp the lifetime of all object
that get created and destroyed. Instead of spanning this thoughout whole
source file we have it nicely encapsulated in this a little horrendeous
_parseDevicePath that is of course to improve more.
2016-07-15 15:29:05 -03:00
Staroselskii Georgii 0ca635bfb8 AP_HAL_Linux: close() console in dtor 2016-07-15 15:28:10 -03:00
Staroselskii Georgii e7a5945056 AP_HAL_Linux: make flow_control a property of SerialDevice rather than UARTDriver's
Make it possible to change flow control settings for individual devices.
2016-07-15 15:26:49 -03:00
Staroselskii Georgii 897d2fb1fb AP_HAL_Linux: use OwnPtr for _device in UARTDriver
Otherwise we're going to leak memory without any need.
Before this fix we've created ConsoleDevice 4 times in case -A switch hadn't been supplied,
but we hadn't ever deleted those. Now there's no memory leak here.
2016-07-15 15:22:51 -03:00
Staroselskii Georgii 3f1e999fc8 AP_HAL_Linux: remove ConsoleDevice construction from UARTDriver constructor
Since we're going to create ConsoleDevice in UARTDriver either way,
there's no need to do anything except setting the console flag.
2016-07-15 14:56:00 -03:00
Lucas De Marchi 24cdef24b8 AP_HAL_Linux: remove wrong ifdef
This was added when the support for navio2 went in, but the same ifdef
is already on the lines above.
2016-07-14 17:32:33 -03:00
Luiz Ywata 3e765e23a9 AP_HAL_Linux: RCOutput_PCA9685: use I2CDevice interface 2016-07-14 17:32:33 -03:00
Lucas De Marchi 08ea1ea263 AP_HAL_Linux: RCOutput_Bebop: follow coding style
Minor changes to follow coding style and improve readability:

    - sort headers
    - move struct definition to compilation unit rather than header
    - Add braces to if, for, etc
2016-07-14 17:32:33 -03:00
Luiz Ywata 7fb5db8077 AP_HAL_Linux: RCOutput_Bebop: use I2CDevice interface 2016-07-14 17:32:33 -03:00
Andrew Tridgell 847bfda48a HAL_Linux: adjust include ordering 2016-07-14 13:39:47 +10:00
Andrew Tridgell dd5d0ffbad HAL_Linux: use default module directory 2016-07-14 13:39:47 +10:00
Andrew Tridgell 107f76828d HAL_Linux: added AP_Module support 2016-07-14 13:39:46 +10:00
Andrew Tridgell f090e9b27c HAL_Linux: fixed makefile build with PRIu64 2016-07-07 15:10:59 +10:00
Andrew Tridgell 461c159b22 HAL_Linux: use set_imu_target_temp() API 2016-07-01 15:29:52 +10:00
Andrew Tridgell beb3591f67 HAL_Linux: improved help output and errors for udp and bcast 2016-06-28 21:01:45 +10:00
Andrew Tridgell 72b5cecdb2 HAL_Linux: added udpin support to HAL_Linux
useful for setting up ardupilot as a mavlink UDP listener
2016-06-28 21:01:43 +10:00
Gustavo Jose de Sousa d35cf60ce1 AP_HAL_Linux: I2CDevice: use read flag in read_registers_multiple
Use the generic support in Device interface for read flag when we are
using read_registers_multiple() method.
2016-06-27 17:20:46 -03:00
Lucas De Marchi b70b9ed8d1 AP_HAL_Linux: fix warning on 64b printf
../../libraries/AP_HAL_Linux/Perf.cpp: In member function ‘void Linux::Perf::_debug_counters()’:
../../libraries/AP_HAL_Linux/Perf.cpp:85:36: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
                     c.name, c.count);
                                    ^
2016-06-25 12:05:55 -03:00
Lucas De Marchi 4a18108600 AP_HAL_Linux: rename min, max and avg fields
These were probably named otherwise in order not to conflict with
min/max macros from math.h. We don't have this problem anymore.
2016-06-23 19:08:14 -03:00
Lucas De Marchi b8e3e549c7 AP_HAL_Linux: Perf: add debug method
Test code for integration with another thread to pull data from internal
perf counters.  Since we are using the timer thread here, there's no
retry mechanism and we only print that data can be corrupted.
2016-06-23 19:08:14 -03:00
Lucas De Marchi 1727418dc9 AP_HAL_Linux: Perf: make lttng use internal fields
Instead of creating a new object Perf_Lttng copying the necessaries
fields, just make a tighter integration with the internal perf counters
and re-use the same fields.
2016-06-23 19:06:30 -03:00