mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/lsm6dsl: migrate to ztimer
This commit is contained in:
parent
40a1dcb35b
commit
1acdec389e
@ -10,4 +10,5 @@ config MODULE_LSM6DSL
|
||||
depends on HAS_PERIPH_I2C
|
||||
depends on TEST_KCONFIG
|
||||
select MODULE_PERIPH_I2C
|
||||
select MODULE_XTIMER
|
||||
select MODULE_ZTIMER
|
||||
select MODULE_ZTIMER_MSEC
|
||||
|
@ -1,2 +1,3 @@
|
||||
FEATURES_REQUIRED += periph_i2c
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
@ -22,8 +22,6 @@
|
||||
#ifndef LSM6DSL_INTERNAL_H
|
||||
#define LSM6DSL_INTERNAL_H
|
||||
|
||||
#include "xtimer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -159,9 +157,9 @@ extern "C" {
|
||||
#define LSM6DSL_TEMP_OFFSET (0x1900)
|
||||
|
||||
/**
|
||||
* @brief Reboot wait interval in us (15ms)
|
||||
* @brief Reboot wait interval in ms (15ms)
|
||||
*/
|
||||
#define LSM6DSL_BOOT_WAIT (15 * US_PER_MS)
|
||||
#define LSM6DSL_BOOT_WAIT_MS (15)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#include "lsm6dsl.h"
|
||||
#include "lsm6dsl_internal.h"
|
||||
@ -62,7 +62,7 @@ int lsm6dsl_init(lsm6dsl_t *dev, const lsm6dsl_params_t *params)
|
||||
/* Reboot */
|
||||
i2c_write_reg(BUS, ADDR, LSM6DSL_REG_CTRL3_C, LSM6DSL_CTRL3_C_BOOT, 0);
|
||||
|
||||
xtimer_usleep(LSM6DSL_BOOT_WAIT);
|
||||
ztimer_sleep(ZTIMER_MSEC, LSM6DSL_BOOT_WAIT_MS);
|
||||
|
||||
if (i2c_read_reg(BUS, ADDR, LSM6DSL_REG_WHO_AM_I, &tmp, 0) < 0) {
|
||||
i2c_release(BUS);
|
||||
|
@ -1,6 +1,7 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += lsm6dsl
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -1,4 +1,5 @@
|
||||
# this file enables modules defined in Kconfig. Do not use this file for
|
||||
# application configuration. This is only needed during migration.
|
||||
CONFIG_MODULE_LSM6DSL=y
|
||||
CONFIG_MODULE_XTIMER=y
|
||||
CONFIG_MODULE_ZTIMER=y
|
||||
CONFIG_MODULE_ZTIMER_MSEC=y
|
||||
|
@ -22,11 +22,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
#include "lsm6dsl.h"
|
||||
#include "lsm6dsl_params.h"
|
||||
|
||||
#define SLEEP_USEC (500UL * US_PER_MS)
|
||||
#define SLEEP_MSEC (500UL)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
@ -55,7 +55,7 @@ int main(void)
|
||||
}
|
||||
puts("[SUCCESS]\n");
|
||||
|
||||
xtimer_sleep(1);
|
||||
ztimer_sleep(ZTIMER_MSEC, 1 * 1000);
|
||||
|
||||
puts("Powering up LSM6DSL sensor...");
|
||||
if (lsm6dsl_acc_power_up(&dev) != LSM6DSL_OK) {
|
||||
@ -95,7 +95,7 @@ int main(void)
|
||||
}
|
||||
|
||||
puts("");
|
||||
xtimer_usleep(SLEEP_USEC);
|
||||
ztimer_sleep(ZTIMER_MSEC, SLEEP_MSEC);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user