mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 02:36:37 +08:00
Replacing usleep with px4_usleep
This is a step towards isolating time from the system.
This commit is contained in:
@@ -133,7 +133,7 @@ __EXPORT void board_peripheral_reset(int ms)
|
||||
stm32_gpiowrite(GPIO_VDD_5V_PERIPH_EN, 1);
|
||||
|
||||
/* wait for the peripheral rail to reach GND */
|
||||
usleep(ms * 1000);
|
||||
px4_usleep(ms * 1000);
|
||||
warnx("reset done, %d ms", ms);
|
||||
|
||||
/* re-enable power */
|
||||
@@ -393,7 +393,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
||||
#endif
|
||||
|
||||
/* Ensure the power is on 1 ms before we drive the GPIO pins */
|
||||
usleep(1000);
|
||||
px4_usleep(1000);
|
||||
|
||||
if (OK == determin_hw_version(&hw_version, & hw_revision)) {
|
||||
switch (hw_version) {
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <px4_time.h>
|
||||
#include <px4_config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -420,7 +421,7 @@ __EXPORT void board_spi_reset(int ms)
|
||||
stm32_gpiowrite(GPIO_VDD_3V3_SENSORS_EN, 0);
|
||||
|
||||
/* wait for the sensor rail to reach GND */
|
||||
usleep(ms * 1000);
|
||||
px4_usleep(ms * 1000);
|
||||
warnx("reset done, %d ms", ms);
|
||||
|
||||
/* re-enable power */
|
||||
@@ -429,7 +430,7 @@ __EXPORT void board_spi_reset(int ms)
|
||||
stm32_gpiowrite(GPIO_VDD_3V3_SENSORS_EN, 1);
|
||||
|
||||
/* wait a bit before starting SPI, different times didn't influence results */
|
||||
usleep(100);
|
||||
px4_usleep(100);
|
||||
|
||||
/* reconfigure the SPI pins */
|
||||
stm32_configgpio(GPIO_SPI1_SCK);
|
||||
|
||||
Reference in New Issue
Block a user