Replacing usleep with px4_usleep

This is a step towards isolating time from the system.
This commit is contained in:
Julian Oes
2018-12-22 10:32:18 +01:00
parent e485885344
commit 5b9dea5604
112 changed files with 339 additions and 305 deletions
+2 -1
View File
@@ -39,6 +39,7 @@
#include <px4_config.h>
#include <px4_defines.h>
#include <px4_time.h>
#include <drivers/device/i2c.h>
@@ -591,7 +592,7 @@ HMC5883::read(struct file *filp, char *buffer, size_t buflen)
}
/* wait for it to complete */
usleep(HMC5883_CONVERSION_INTERVAL);
px4_usleep(HMC5883_CONVERSION_INTERVAL);
/* run the collection phase */
if (OK != collect()) {
+5 -4
View File
@@ -39,6 +39,7 @@
* Based on the hmc5883 driver.
*/
#include <px4_time.h>
#include "lis3mdl.h"
LIS3MDL::LIS3MDL(device::Device *interface, const char *path, enum Rotation rotation) :
@@ -146,7 +147,7 @@ LIS3MDL::calibrate(struct file *file_pointer, unsigned enable)
goto out;
}
usleep(20000);
px4_usleep(20000);
/* discard 10 samples to let the sensor settle */
for (uint8_t i = 0; i < num_samples; i++) {
@@ -211,7 +212,7 @@ LIS3MDL::calibrate(struct file *file_pointer, unsigned enable)
goto out;
}
usleep(60000);
px4_usleep(60000);
/* discard 10 samples to let the sensor settle */
for (uint8_t i = 0; i < num_samples; i++) {
@@ -285,7 +286,7 @@ out:
set_range(4);
set_default_register_values();
usleep(20000);
px4_usleep(20000);
return ret;
}
@@ -687,7 +688,7 @@ LIS3MDL::read(struct file *file_pointer, char *buffer, size_t buffer_len)
}
/* wait for it to complete */
usleep(LIS3MDL_CONVERSION_INTERVAL);
px4_usleep(LIS3MDL_CONVERSION_INTERVAL);
/* run the collection phase */
if (collect() != OK) {