Commit Graph

527 Commits

Author SHA1 Message Date
Staroselskii Georgii 60426faa52 AP_HAL_Linux: changed ADC logic a bit for Navio 2
- make voltage_average_ratiometric() the same as voltage_average()
- make read_latest() the same as voltage_average()

wip
2016-04-27 17:14:21 +03:00
Rustom Jehangir 4a10156b13 AP_HAL_Linux: Fix RCInput::read from stopping at any zero channel
This bug led to issues for us so it may help others to resolve it.
Currently, the AP_HAL_Linux RCInput::read(uint16_t*,uint8_t) function
only returns the first x nonzero channels. Once it hits a channel that
is set to zero, it stops and all remaining channels are returned as
zero, even if they are set. This causes discrepancies between the raw RC
input sent to the GCS and the RC input that is actually used on the
vehicle.

The fixes this issue and makes it behave exactly as it does on the
PX4_HAL code. We ran into this issue when sending rc_override messages
in which there were some channels set to zero.
2016-04-26 22:32:07 -03:00
mirkix 6e546ba181 AP_HAL_Linux: Fix compiler warning unused hal 2016-04-24 11:09:55 -03:00
mirkix 2aba5a4643 AP_HAL_Linux: BBBmini add second MPU9250 2016-04-24 10:57:57 -03:00
Randy Mackay 58e65c836f HAL_Linux: remove unused pru_chan_map from RCOutput 2016-04-23 23:06:24 -07:00
Randy Mackay d6d5bac419 RCInput_UART: remove unused _count, _direction
resolves a compiler warning
2016-04-23 23:06:23 -07:00
Andrew Tridgell c7dabad02c HAL_Linux: added uartF 2016-04-20 09:39:49 +10:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Andrew Tridgell 1e4fe7996e HAL_Linux: update URL 2016-03-25 20:47:53 +11:00
Lucas De Marchi 72b246e52c AP_HAL_Linux: fix use of 0-length array
0-length arrays are supported in C but forbidden in C++. GCC allows it
but clang is more strict:

../../libraries/AP_HAL_Linux/SPIDriver.cpp:75:35: fatal error: no matching constructor for initialization of 'Linux::SPIDeviceDriver [0]'
SPIDeviceDriver SPIDeviceManager::_device[0];
                                  ^
../../libraries/AP_HAL_Linux/SPIDriver.h:20:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 0 were provided
class SPIDeviceDriver : public AP_HAL::SPIDeviceDriver {
      ^
../../libraries/AP_HAL_Linux/SPIDriver.h:20:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
../../libraries/AP_HAL_Linux/SPIDriver.h:25:5: note: candidate constructor not viable: requires 9 arguments, but 0 were provided
    SPIDeviceDriver(const char *name, uint16_t bus, uint16_t subdev, enum AP_HAL::SPIDeviceType type, uint8_t mode, uint8_t bitsPerWord, int16_t cs_pin, uint32_t lowspeed, uint32_t highspeed);
    ^
1 error generated.
2016-03-20 00:17:02 -03:00
raspilot 9d787e44cc AP_HAL_Linux: update spi table for raspilot 2016-03-18 21:51:37 -03:00
Lucas De Marchi c1623c21cc AP_HAL_Linux: rename ToneAlarmDriver to follow other names
We don't add "Driver" to the name of the files anymore.
2016-03-18 21:51:37 -03:00
Lucas De Marchi d52ee7c0a1 AP_HAL_Linux: ToneAlarmDriver_Raspilot: cleanup driver
- Fix coding style
  - Remove unused variables and members
  - Add virtual as needed and override where needed
2016-03-18 21:51:36 -03:00
Pritam Ghanghas 6de5b52974 AP_HAL_Linux: separate class for tone alarm driver 2016-03-18 21:51:36 -03:00
Lucas De Marchi 6a6175df1c AP_HAL_Linux: move dirname to I2CDevice core
All entries would need the "devices/" prefix and it's more natural not
using it.
2016-03-17 02:55:31 -03:00
Staroselskii Georgii f93e790717 AP_HAL_Linux: make Ublox work on the higher frequency
The lower speed was only valid for very old Navio's. All new boards ship
with the GPSs that support higher frequencies.
2016-02-27 03:06:50 -03:00
Staroselskii Georgii a327a8779e AP_HAL_Linux: added Navio2 support 2016-02-27 03:06:50 -03:00
Staroselskii Georgii 7187f26220 AP_HAL_Linux: use Raspberry Pi GPIO for Navio2 2016-02-27 03:06:50 -03:00
Staroselskii Georgii 6680baf777 AP_HAL_Linux: use MPU9250 for Navio2 2016-02-27 03:06:50 -03:00
Staroselskii Georgii c9869e768a AP_HAL_Linux: use Util_RPI for Navio2 2016-02-27 03:06:50 -03:00
Staroselskii Georgii 23a2cf45aa AP_HAL_Linux: added RCInput for Navio2 2016-02-27 03:06:50 -03:00
Staroselskii Georgii a24e9df765 AP_HAL_Linux: added AnalogIn_Navio2
This is a shim driver around the temporarily interface that is exported via
sysfs entries.
2016-02-27 03:06:50 -03:00
Lucas De Marchi 69f6a73c19 Global: fix missing renames for HAL_BOARD_SUBTYPE_LINUX_ERLEBOARD
Commit b87fd58 (AP_HAL: ERLEBOARD legacy support) renamed the define but
forgot some around.
2016-02-19 12:35:18 -02:00
Lucas De Marchi 3ace8b52de AP_HAL_Linux: use AnalogIn_IIO for minlure 2016-02-19 11:55:31 -02:00
Lucas De Marchi 4e034cd2e1 AP_HAL_Linux: AnalogIn_IIO: add scale for minlure 2016-02-19 11:55:31 -02:00
Lucas De Marchi f56a80cd80 AP_HAL_Linux: AnalogIn_IIO: return fixed board voltage
Return board voltage as 5V so we don't fail prearm checks.
2016-02-19 11:55:31 -02:00
Lucas De Marchi 705393b30c AP_HAL_Linux: replace header guard with pragma once 2016-02-18 14:52:35 -02:00
mirkix 8da58226ae AP_HAL_Linux: Fix BBBmini IIO scaling 2016-02-18 00:00:07 -02:00
Lucas De Marchi 3060c3da3c AP_HAL_Linux: Add fake device to SPIDriver
This allows us to re-use SPIDevice from SPIDeviceDriver (the
to-become-SPIDeviceProperties) while the drivers are
converted.  We create a fake device by calling the temporary
SPIDeviceManager::get_device() method passing the descriptor. The
transfer and assert logic is still using the old code.

Now we can interoperate SPIDeviceDriver with the ones based in
SPIDevice since they are going to use the same semaphore and bus.
2016-02-16 19:49:09 -02:00
Lucas De Marchi 61ef653181 AP_HAL_Linux: implement SPIDevice
The way this code is structured is a little bit different from the
SPIDriver implementation:

 - We only open the bus once, no matter how many devices we have in it

 - There's a single transfer() method which uses half-duplex mode
   instead of full duplex. The reason is that for all cases in the
   codebase we are using half-duplex transfers using the full-duplex
   API, i.e. a single SPI msg with both tx and rx buffers. This is
   cumbersome because the buffers need to be of the same size and the
   receive buffer using an offset of the same length as the actux data
   being written. This means the high level APIs need to copy buffers
   around.

   If later we have uses for a real full duplex case it's just a matter
   of adding another transfer_fullduplex() method or something like
   this.

 - The methods are implemented in the SPIDevice class instead of having
   proxy methods to SPIDeviceManager as is the case of SPIDriver

Also from now on we refer to the SPIDriver objects as "descriptors"
because they have the parameters of each device in the
SPIDeviceManager::devices[] table. When SPIDeviceDriver is completely
replaced we can rename them to SPIDeviceProperties.
2016-02-16 19:49:09 -02:00
Lucas De Marchi 0d1bb7aa84 AP_HAL_Linux: export number of SPI devices
Save in the manager the number of devices so it can be used in other
places like the SPIDevice implementation. This is a temporary storage
while we migrate to SPIDevice.

While at it use protected rather than private.
2016-02-16 19:49:09 -02:00
Lucas De Marchi e40785b002 AP_HAL_Linux: Add fake device to I2CDriver
This allows us to re-use I2CDevice from I2CDriver while the drivers are
converted.  We create a fake device with addr = 0 for each I2CDriver but
we only use the register/unregister logic. The transfer logic still uses
the methods from I2CDriver in order to use the right address.

Now we can interoperate I2CDevice drivers with the ones base in
I2CDriver since they are going to use the same semaphore and bus.

The I2CDriver constructors were changed to re-use the logic in I2CDevice
(it uses a number rather than an string) and the semaphore doesn't live
outside anymore, its embedded in the fake I2CDevice, as well as the
bus's file descritor.
2016-02-16 19:49:09 -02:00
Lucas De Marchi 5194f7e5ce AP_HAL_Linux: I2CDevice: method to read multiple times 2016-02-16 19:49:09 -02:00
Lucas De Marchi c394de31a0 AP_HAL_Linux: register I2CManager instance 2016-02-16 19:49:09 -02:00
Lucas De Marchi bc2f7f2783 AP_HAL_Linux: implement function to transfer data
This is a similar function to what we have in I2CDriver, but it can
receive a nullptr to recv or send.  It will create 2 i2c_msg structs to
send and receive data to/from the I2C slave.
2016-02-16 19:49:08 -02:00
Lucas De Marchi 2fc534d18d AP_HAL_Linux: implement methods to open the bus
These are very similar to their counterparts in I2CDriver. The changes
were:
    - Don't use fixed buffer with PATH_MAX length: allocate the string
    - Change the interface to use std::vector so we can simplify the
      implementation
2016-02-16 19:49:08 -02:00
Lucas De Marchi cd0e1dff82 AP_HAL_Linux: Add skeleton for I2CDevice
This adds the logic to maintain the I2CDevice's managed by I2CManager.
2016-02-16 19:49:08 -02:00
Lucas De Marchi 7debd14683 AP_HAL_Linux: Scheduler: remove unused _in_io_proc 2016-02-12 23:42:34 -02:00
Lucas De Marchi fbb3bb2fd0 AP_HAL_Linux: Scheduler: remove unused _timer_event_missed 2016-02-12 23:42:34 -02:00
Lucas De Marchi f39a6745d1 Global: remove unused _timer_pending from scheduler 2016-02-12 23:42:34 -02:00
Lucas De Marchi 0ad436c337 AP_HAL_Linux: Scheduler: bring back scheduler table
Use a scheduler table to list threads' properties in a single place.
2016-02-12 23:42:34 -02:00
Lucas De Marchi a1b62b4984 AP_HAL_Linux: Scheduler: use PeriodicThread
Some tasks were not accounting for the time to execute the tasks. Now
that we are using the infra from PeriodicThread all of them are.
2016-02-12 23:42:34 -02:00
Lucas De Marchi 48e81c8589 AP_HAL_Linux: Thread: add PeriodicThread helper
This is a helper class to run a single periodic function like the ones
used in the scheduler.
2016-02-12 23:42:34 -02:00
Lucas De Marchi 860d5aaf84 AP_HAL_Linux: Scheduler: move rpcmem initialization to setup phase
This was the only piece remaining in the timer thread that was used only
to setup the thread.
2016-02-12 23:42:34 -02:00
Lucas De Marchi 0282ebb8ff AP_HAL_Linux: add method to check caller same as thread 2016-02-12 23:42:34 -02:00
Lucas De Marchi e3beef0f77 AP_HAL_Linux: Scheduler: remove unused parameter 2016-02-12 23:42:34 -02:00
Lucas De Marchi 2b61eaf9f2 Global: remove {begin,end}_atomic from scheduler
These are never used and largely not implemented.
2016-02-12 23:42:34 -02:00
Lucas De Marchi 9aa49cda93 Global: remove system_initializing() from scheduler
This is not used anymore.
2016-02-12 23:42:34 -02:00
Lucas De Marchi 9cf9fc152b AP_HAL_Linux: use pthread's barrier instead of polling
Use pthread's barrier so we don't keep waking up threads with possibly
higher priority during initialization phase.

This also synchronizes all of them to a single point. With the previous
approach it was possible (but unlikely) that a thread hadn't reach the
synchronization point when main thread signalize "system initialized".
2016-02-12 23:42:34 -02:00
Lucas De Marchi 2b0e214168 AP_HAL_Linux: Scheduler: move synchronization to common method 2016-02-12 23:42:34 -02:00