From adb032d2e553deda0f6a1af9eacbc4972dd2e155 Mon Sep 17 00:00:00 2001 From: rfu Date: Tue, 31 Mar 2020 15:16:32 +0200 Subject: [PATCH] drivers: up_udelay -> px4_usleep --- src/drivers/imu/bmi088/BMI088_accel.cpp | 4 ++-- src/drivers/imu/bmi088/BMI088_gyro.cpp | 3 ++- src/drivers/imu/icm20948/ICM20948_mag.cpp | 3 ++- src/drivers/magnetometer/bmm150/bmm150.cpp | 10 ++++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/drivers/imu/bmi088/BMI088_accel.cpp b/src/drivers/imu/bmi088/BMI088_accel.cpp index 035f2e2e2a..623da69890 100644 --- a/src/drivers/imu/bmi088/BMI088_accel.cpp +++ b/src/drivers/imu/bmi088/BMI088_accel.cpp @@ -120,7 +120,7 @@ int BMI088_accel::reset() * Setting it to 5ms. */ - up_udelay(5000); + px4_usleep(5000); // Perform a dummy read here to put the accelerometer part of the BMI088 back into SPI mode after the reset // The dummy read basically pulls the chip select line low and then high @@ -134,7 +134,7 @@ int BMI088_accel::reset() * Any communication with the sensor during this time should be avoided * (see section "Power Modes: Acceleromter" in the BMI datasheet) */ - up_udelay(5000); + px4_usleep(5000); // Set the PWR CONF to be active write_checked_reg(BMI088_ACC_PWR_CONF, BMI088_ACC_PWR_CONF_ACTIVE); // Sets the accelerometer to active mode diff --git a/src/drivers/imu/bmi088/BMI088_gyro.cpp b/src/drivers/imu/bmi088/BMI088_gyro.cpp index d4ed11522d..2dee5d568e 100644 --- a/src/drivers/imu/bmi088/BMI088_gyro.cpp +++ b/src/drivers/imu/bmi088/BMI088_gyro.cpp @@ -104,7 +104,8 @@ int BMI088_gyro::reset() //Enable Gyroscope in normal mode write_reg(BMI088_GYR_LPM1, BMI088_GYRO_NORMAL); - up_udelay(1000); + + px4_usleep(1000); uint8_t retries = 10; diff --git a/src/drivers/imu/icm20948/ICM20948_mag.cpp b/src/drivers/imu/icm20948/ICM20948_mag.cpp index 35fb2d9e68..ffa97c69b8 100644 --- a/src/drivers/imu/icm20948/ICM20948_mag.cpp +++ b/src/drivers/imu/icm20948/ICM20948_mag.cpp @@ -311,7 +311,8 @@ ICM20948_mag::ak09916_setup(void) retries--; PX4_WARN("AK09916: bad id %d retries %d", id, retries); _parent->modify_reg(ICMREG_20948_USER_CTRL, 0, BIT_I2C_MST_RST); - up_udelay(100); + + px4_usleep(100) ; } while (retries > 0); if (retries == 0) { diff --git a/src/drivers/magnetometer/bmm150/bmm150.cpp b/src/drivers/magnetometer/bmm150/bmm150.cpp index a94cdefe3e..ecbf85fbe5 100644 --- a/src/drivers/magnetometer/bmm150/bmm150.cpp +++ b/src/drivers/magnetometer/bmm150/bmm150.cpp @@ -96,8 +96,8 @@ int BMM150::init() /* Bring the device to sleep mode */ modify_reg(BMM150_POWER_CTRL_REG, 1, 1); - up_udelay(10000); + px4_usleep(10000); /* check id*/ if (read_reg(BMM150_CHIP_ID_REG) != BMM150_CHIP_ID) { @@ -115,7 +115,7 @@ int BMM150::init() return -EIO; } - up_udelay(10000); + px4_usleep(10000); if (collect()) { return -EIO; @@ -342,11 +342,13 @@ int BMM150::reset() /* Soft-reset */ modify_reg(BMM150_POWER_CTRL_REG, BMM150_SOFT_RESET_MASK, BMM150_SOFT_RESET_VALUE); - up_udelay(5000); + + px4_usleep(5000); /* Enable Magnetometer in normal mode */ ret += set_power_mode(BMM150_DEFAULT_POWER_MODE); - up_udelay(1000); + + px4_usleep(1000); /* Set the data rate to default */ ret += set_data_rate(BMM150_DEFAULT_ODR);