diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/drivers/device/i2c.cpp | 24 | ||||
-rw-r--r-- | apps/drivers/device/i2c.h | 20 | ||||
-rw-r--r-- | apps/drivers/drv_range_finder.h | 4 | ||||
-rw-r--r-- | apps/drivers/mb12xx/Makefile | 2 | ||||
-rw-r--r-- | apps/drivers/mb12xx/mb12xx.cpp | 12 |
5 files changed, 9 insertions, 53 deletions
diff --git a/apps/drivers/device/i2c.cpp b/apps/drivers/device/i2c.cpp index c6102a6c1..a416801eb 100644 --- a/apps/drivers/device/i2c.cpp +++ b/apps/drivers/device/i2c.cpp @@ -115,30 +115,6 @@ I2C::probe() } int -I2C::write(const uint8_t *send, unsigned send_len) -{ - int ret = OK; - - I2C_SETFREQUENCY(_dev, _frequency); - I2C_SETADDRESS(_dev, _address, 7); - ret = I2C_WRITE(_dev, send, send_len); - - return ret; -} - -int -I2C::read(uint8_t *recv, unsigned recv_len) -{ - int ret = OK; - - I2C_SETFREQUENCY(_dev, _frequency); - I2C_SETADDRESS(_dev, _address, 7); - ret = I2C_READ(_dev, recv, recv_len); - - return ret; -} - -int I2C::transfer(const uint8_t *send, unsigned send_len, uint8_t *recv, unsigned recv_len) { struct i2c_msg_s msgv[2]; diff --git a/apps/drivers/device/i2c.h b/apps/drivers/device/i2c.h index 874b22301..472bf26ab 100644 --- a/apps/drivers/device/i2c.h +++ b/apps/drivers/device/i2c.h @@ -84,26 +84,6 @@ protected: * Check for the presence of the device on the bus. */ virtual int probe(); - - /** - * Perform an I2C write to the device. - * - * @param send Pointer to bytes to send. - * @param send_len Number of bytes to send. - * @return OK if the transfer was successful, -errno - * otherwise. - */ - int write(const uint8_t *send, unsigned send_len); - - /** - * Perform an I2C read from the device. - * - * @param send Pointer to bytes to send. - * @param send_len Number of bytes to send. - * @return OK if the transfer was successful, -errno - * otherwise. - */ - int read(uint8_t *recv, unsigned recv_len); /** * Perform an I2C transaction to the device. diff --git a/apps/drivers/drv_range_finder.h b/apps/drivers/drv_range_finder.h index 420011be5..0fe8564ac 100644 --- a/apps/drivers/drv_range_finder.h +++ b/apps/drivers/drv_range_finder.h @@ -57,14 +57,14 @@ struct range_finder_report { }; /* - * ObjDev tag for raw accelerometer data. + * ObjDev tag for raw range finder data. */ ORB_DECLARE(sensor_range_finder); /* * ioctl() definitions * - * Accelerometer drivers also implement the generic sensor driver + * Rangefinder drivers also implement the generic sensor driver * interfaces from drv_sensor.h */ diff --git a/apps/drivers/mb12xx/Makefile b/apps/drivers/mb12xx/Makefile index b5b911be1..0d2405787 100644 --- a/apps/drivers/mb12xx/Makefile +++ b/apps/drivers/mb12xx/Makefile @@ -37,6 +37,6 @@ APPNAME = mb12xx PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +STACKSIZE = 2048 include $(APPDIR)/mk/app.mk diff --git a/apps/drivers/mb12xx/mb12xx.cpp b/apps/drivers/mb12xx/mb12xx.cpp index d7a3357c8..0e4712f5a 100644 --- a/apps/drivers/mb12xx/mb12xx.cpp +++ b/apps/drivers/mb12xx/mb12xx.cpp @@ -157,7 +157,7 @@ private: /** * Set the min and max distance thresholds if you want the end points of the sensors - * range to be bought in at all, otherwise it will use the defaults MB12XX_MIN_DISTANCE + * range to be brought in at all, otherwise it will use the defaults MB12XX_MIN_DISTANCE * and MB12XX_MAX_DISTANCE */ void set_minimum_distance(float min); @@ -388,13 +388,13 @@ MB12XX::ioctl(struct file *filp, int cmd, unsigned long arg) case RANGEFINDERIOCSETMINIUMDISTANCE: { - set_minimum_distance((float)arg); + set_minimum_distance(*(float *)arg); return 0; } break; case RANGEFINDERIOCSETMAXIUMDISTANCE: { - set_maximum_distance((float)arg); + set_maximum_distance(*(float *)arg); return 0; } break; @@ -471,8 +471,8 @@ MB12XX::measure() /* * Send the command to begin a measurement. */ - uint8_t cmd[] = {MB12XX_TAKE_RANGE_REG}; - ret = I2C::write(&cmd[0], 1); + uint8_t cmd = MB12XX_TAKE_RANGE_REG; + ret = transfer(&cmd, 1, nullptr, 0); if (OK != ret) { @@ -495,7 +495,7 @@ MB12XX::collect() perf_begin(_sample_perf); - ret = I2C::read(&val[0], 2); + ret = transfer(nullptr, 0, &val[0], 2); if (ret < 0) { |