Skip to content

Commit

Permalink
fixup! pkg/driver_vl53l1x_st_api: vendor API used by vl53l1x driver
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Dec 13, 2022
1 parent 75c470f commit b06ad42
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/driver_vl53l1x_st_api/platform/vl53l1_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
#include <string.h>

#include "periph/i2c.h"
#include "xtimer.h"
#include "ztimer.h"

#include "vl53l1x.h"

Expand Down Expand Up @@ -343,8 +343,7 @@ VL53L1_Error VL53L1_GetTickCount(uint32_t *ptick_count_ms)
ASSERT_PARAM(ptick_count_ms != NULL);
DEBUG_NODEV("ptick_count_ms=%p", ptick_count_ms);

uint64_t time = xtimer_now_usec64();
*ptick_count_ms = time / (US_PER_MS);
*ptick_count_ms = ztimer_now(ZTIMER_MSEC);

return status;
}
Expand All @@ -367,7 +366,7 @@ VL53L1_Error VL53L1_WaitMs(VL53L1_Dev_t *pdev, int32_t wait_ms){
ASSERT_PARAM(pdev != NULL);
DEBUG_NODEV("wait_ms=%d", wait_ms);

xtimer_usleep (wait_ms * US_PER_MS);
ztimer_sleep(ZTIMER_MSEC, wait_ms);

return status;
}
Expand All @@ -379,7 +378,7 @@ VL53L1_Error VL53L1_WaitUs(VL53L1_Dev_t *pdev, int32_t wait_us)
ASSERT_PARAM(pdev != NULL);
DEBUG_NODEV("wait_us=%d", wait_us);

xtimer_usleep (wait_us);
ztimer_sleep(ZTIMER_USEC, wait_us);

return status;
}
Expand All @@ -405,7 +404,7 @@ VL53L1_Error VL53L1_WaitValueMaskEx(VL53L1_Dev_t *pdev,
if ((data & mask) == value) {
return VL53L1_ERROR_NONE;
}
xtimer_usleep(poll_delay_ms * US_PER_MS);
ztimer_sleep(ZTIMER_MSEC, poll_delay_ms);
timeout_ms -= (poll_delay_ms < timeout_ms) ? poll_delay_ms : timeout_ms;
}

Expand Down

0 comments on commit b06ad42

Please sign in to comment.