Commit Graph

14 Commits

Author SHA1 Message Date
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 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
Lucas De Marchi 590539f674 AP_HAL_Linux: implement threaded I2C 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
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
Gustavo Jose de Sousa d615628367 AP_HAL_Linux: I2CDevice: add missing stdio.h include
This was probably being included by another header, but it's not on
gcc >= 6.1 and glibc 2.23.
2016-05-16 13:12:53 -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
Lucas De Marchi 5194f7e5ce AP_HAL_Linux: I2CDevice: method to read multiple times 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