Refactor the ll40ls namespace driver methods to more closely match the cm8jl65, mappydot, leddar_one, and other distance sensor driver implementations.

This commit is contained in:
mcsauder
2019-09-27 07:55:53 +01:00
committed by Nuno Marques
parent 8ce4a15778
commit 7b16c3482d
13 changed files with 364 additions and 324 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ namespace device
unsigned int I2C::_bus_clocks[BOARD_NUMBER_I2C_BUSES] = BOARD_I2C_BUS_CLOCK_INIT;
I2C::I2C(const char *name, const char *devname, int bus, uint16_t address, uint32_t frequency) :
I2C::I2C(const char *name, const char *devname, const int bus, const uint16_t address, const uint32_t frequency) :
CDev(name, devname),
_frequency(frequency)
{
@@ -167,7 +167,7 @@ out:
}
int
I2C::transfer(const uint8_t *send, unsigned send_len, uint8_t *recv, unsigned recv_len)
I2C::transfer(const uint8_t *send, const unsigned send_len, uint8_t *recv, const unsigned recv_len)
{
px4_i2c_msg_t msgv[2];
unsigned msgs;
+2 -2
View File
@@ -81,7 +81,7 @@ protected:
* @param address I2C bus address, or zero if set_address will be used
* @param frequency I2C bus frequency for the device (currently not used)
*/
I2C(const char *name, const char *devname, int bus, uint16_t address, uint32_t frequency);
I2C(const char *name, const char *devname, const int bus, const uint16_t address, const uint32_t frequency);
virtual ~I2C();
/**
@@ -101,7 +101,7 @@ protected:
* @return OK if the transfer was successful, -errno
* otherwise.
*/
int transfer(const uint8_t *send, unsigned send_len, uint8_t *recv, unsigned recv_len);
int transfer(const uint8_t *send, const unsigned send_len, uint8_t *recv, const unsigned recv_len);
bool external() { return px4_i2c_bus_external(_device_id.devid_s.bus); }
+2 -2
View File
@@ -59,7 +59,7 @@ static constexpr const int simulate = PX4_SIMULATE_I2C;
namespace device
{
I2C::I2C(const char *name, const char *devname, int bus, uint16_t address, uint32_t frequency) :
I2C::I2C(const char *name, const char *devname, const int bus, const uint16_t address, const uint32_t frequency) :
CDev(name, devname)
{
DEVICE_DEBUG("I2C::I2C name = %s devname = %s", name, devname);
@@ -119,7 +119,7 @@ I2C::init()
}
int
I2C::transfer(const uint8_t *send, unsigned send_len, uint8_t *recv, unsigned recv_len)
I2C::transfer(const uint8_t *send, const unsigned send_len, uint8_t *recv, const unsigned recv_len)
{
#ifndef __PX4_LINUX
return PX4_ERROR;
+2 -2
View File
@@ -78,7 +78,7 @@ protected:
* @param address I2C bus address, or zero if set_address will be used
* @param frequency I2C bus frequency for the device (currently not used)
*/
I2C(const char *name, const char *devname, int bus, uint16_t address, uint32_t frequency = 0);
I2C(const char *name, const char *devname, const int bus, const uint16_t address, const uint32_t frequency = 0);
virtual ~I2C();
/**
@@ -98,7 +98,7 @@ protected:
* @return OK if the transfer was successful, -errno
* otherwise.
*/
int transfer(const uint8_t *send, unsigned send_len, uint8_t *recv, unsigned recv_len);
int transfer(const uint8_t *send, const unsigned send_len, uint8_t *recv, const unsigned recv_len);
bool external() { return px4_i2c_bus_external(_device_id.devid_s.bus); }