mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #17309 from aabadie/pr/pkg/ztimer
pkg: migrate some packages to ztimer
This commit is contained in:
commit
de7df7201a
@ -9,7 +9,8 @@ menuconfig MODULE_BME680
|
||||
bool "BME680 Temperature/Humidity/Pressure/Gas sensor"
|
||||
depends on TEST_KCONFIG
|
||||
select PACKAGE_DRIVER_BME680
|
||||
select MODULE_XTIMER if MODULE_SAUL
|
||||
select MODULE_ZTIMER if MODULE_SAUL
|
||||
select MODULE_ZTIMER_MSEC if MODULE_SAUL
|
||||
|
||||
if MODULE_BME680
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
USEPKG += driver_bme680
|
||||
|
||||
ifneq (,$(filter saul%,$(USEMODULE)))
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
endif
|
||||
|
||||
ifneq (,$(filter bme680_i2c,$(USEMODULE)))
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "saul.h"
|
||||
#include "bme680.h"
|
||||
#include "bme680_params.h"
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
extern bme680_t bme680_devs_saul[BME680_NUMOF];
|
||||
|
||||
@ -65,7 +65,7 @@ static int _read(int dev)
|
||||
if ((drt = bme680_get_duration(&bme680_devs_saul[dev])) < 0) {
|
||||
return BME680_INVALID;
|
||||
}
|
||||
xtimer_msleep(drt);
|
||||
ztimer_sleep(ZTIMER_MSEC, drt);
|
||||
|
||||
bme680_field_data_t data;
|
||||
if ((res = bme680_get_data(&bme680_devs_saul[dev], &data)) != BME680_OK) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_usec
|
||||
FEATURES_REQUIRED += periph_i2c
|
||||
FEATURES_OPTIONAL += periph_i2c_reconfigure
|
||||
DEFAULT_MODULE += auto_init_security
|
||||
|
@ -19,7 +19,8 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "xtimer.h"
|
||||
#include "timex.h"
|
||||
#include "ztimer.h"
|
||||
#include "periph/i2c.h"
|
||||
#include "periph/gpio.h"
|
||||
|
||||
@ -29,17 +30,17 @@
|
||||
/* Timer functions */
|
||||
void atca_delay_us(uint32_t delay)
|
||||
{
|
||||
xtimer_usleep(delay);
|
||||
ztimer_sleep(ZTIMER_USEC, delay);
|
||||
}
|
||||
|
||||
void atca_delay_10us(uint32_t delay)
|
||||
{
|
||||
xtimer_usleep(delay * 10);
|
||||
ztimer_sleep(ZTIMER_USEC, delay * 10);
|
||||
}
|
||||
|
||||
void atca_delay_ms(uint32_t delay)
|
||||
{
|
||||
xtimer_usleep(delay * 1000);
|
||||
ztimer_sleep(ZTIMER_USEC, delay * US_PER_MS);
|
||||
}
|
||||
|
||||
/* Hal I2C implementation */
|
||||
|
@ -9,6 +9,8 @@ config PACKAGE_DRIVER_BME680
|
||||
bool "BME680 sensor driver package"
|
||||
depends on TEST_KCONFIG
|
||||
select MODULE_DRIVER_BME680_CONTRIB
|
||||
select MODULE_ZTIMER
|
||||
select MODULE_ZTIMER_MSEC
|
||||
|
||||
config MODULE_DRIVER_BME680_CONTRIB
|
||||
bool
|
||||
|
@ -1 +1,3 @@
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
USEMODULE += driver_bme680_contrib
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "periph/spi.h"
|
||||
#endif
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#ifndef BME680_SPI_SPEED
|
||||
#define BME680_SPI_SPEED (SPI_CLK_1MHZ)
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
void bme680_ms_sleep(uint32_t msleep)
|
||||
{
|
||||
xtimer_msleep(msleep);
|
||||
ztimer_sleep(ZTIMER_MSEC, msleep);
|
||||
}
|
||||
|
||||
#ifdef MODULE_PERIPH_I2C
|
||||
|
@ -10,7 +10,8 @@ config PACKAGE_U8G2
|
||||
depends on TEST_KCONFIG
|
||||
depends on HAS_PERIPH_GPIO
|
||||
select MODULE_PERIPH_GPIO
|
||||
select MODULE_XTIMER
|
||||
select MODULE_ZTIMER
|
||||
select MODULE_ZTIMER_USEC
|
||||
select MODULE_U8G2_RIOT
|
||||
select MODULE_U8G2_CSRC
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_usec
|
||||
|
||||
FEATURES_REQUIRED += periph_gpio
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "u8x8_riotos.h"
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#ifdef MODULE_PERIPH_SPI
|
||||
#include "periph/spi.h"
|
||||
@ -97,14 +97,14 @@ uint8_t u8x8_gpio_and_delay_riotos(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, v
|
||||
_enable_pins(u8x8_riot_ptr);
|
||||
break;
|
||||
case U8X8_MSG_DELAY_MILLI:
|
||||
xtimer_usleep(arg_int * 1000);
|
||||
ztimer_sleep(ZTIMER_USEC, arg_int * 1000);
|
||||
break;
|
||||
case U8X8_MSG_DELAY_10MICRO:
|
||||
xtimer_usleep(arg_int * 10);
|
||||
ztimer_sleep(ZTIMER_USEC, arg_int * 10);
|
||||
break;
|
||||
case U8X8_MSG_DELAY_100NANO:
|
||||
/* not used in upstream so approximating to 1us should be fine */
|
||||
xtimer_usleep(1);
|
||||
ztimer_sleep(ZTIMER_USEC, 1);
|
||||
break;
|
||||
case U8X8_MSG_GPIO_CS:
|
||||
if (u8x8_riot_ptr != NULL && gpio_is_valid(u8x8_riot_ptr->pin_cs)) {
|
||||
|
@ -10,7 +10,8 @@ config PACKAGE_UCGLIB
|
||||
depends on TEST_KCONFIG
|
||||
depends on HAS_PERIPH_GPIO
|
||||
select MODULE_PERIPH_GPIO
|
||||
select MODULE_XTIMER
|
||||
select MODULE_ZTIMER
|
||||
select MODULE_ZTIMER_USEC
|
||||
select MODULE_UCGLIB_RIOT
|
||||
select MODULE_UCGLIB_CSRC
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_usec
|
||||
|
||||
FEATURES_REQUIRED += periph_gpio
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "ucg_riotos.h"
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#ifdef MODULE_PERIPH_SPI
|
||||
#include "periph/spi.h"
|
||||
@ -101,7 +101,7 @@ int16_t ucg_com_hw_spi_riotos(ucg_t *ucg, int16_t msg, uint16_t arg, uint8_t *da
|
||||
spi_release(dev);
|
||||
break;
|
||||
case UCG_COM_MSG_DELAY:
|
||||
xtimer_usleep(arg);
|
||||
ztimer_sleep(ZTIMER_USEC, arg);
|
||||
break;
|
||||
case UCG_COM_MSG_CHANGE_RESET_LINE:
|
||||
if (ucg_riot_ptr != NULL && gpio_is_valid(ucg_riot_ptr->pin_reset)) {
|
||||
|
@ -3,7 +3,8 @@ include ../Makefile.tests_common
|
||||
DRIVER ?= bme680_i2c
|
||||
|
||||
USEMODULE += $(DRIVER)
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
ifeq ($(ENABLE_FP),1)
|
||||
USEMODULE += bme680_fp
|
||||
|
@ -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_BME680=y
|
||||
CONFIG_MODULE_XTIMER=y
|
||||
CONFIG_MODULE_ZTIMER=y
|
||||
CONFIG_MODULE_ZTIMER_MSEC=y
|
||||
|
@ -25,15 +25,16 @@
|
||||
#include "bme680.h"
|
||||
#include "bme680_params.h"
|
||||
#include "mutex.h"
|
||||
#include "xtimer.h"
|
||||
#include "timex.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#define BME680_TEST_PERIOD_US (5 * US_PER_SEC)
|
||||
#define BME680_TEST_PERIOD_MS (5 * MS_PER_SEC) /* 5s */
|
||||
|
||||
xtimer_t timer;
|
||||
ztimer_t timer;
|
||||
|
||||
static void _timer_cb(void *arg)
|
||||
{
|
||||
xtimer_set(&timer, BME680_TEST_PERIOD_US);
|
||||
ztimer_set(ZTIMER_MSEC, &timer, BME680_TEST_PERIOD_MS);
|
||||
mutex_unlock(arg);
|
||||
}
|
||||
|
||||
@ -64,7 +65,7 @@ int main(void)
|
||||
|
||||
timer.callback = _timer_cb;
|
||||
timer.arg = &timer_mtx;
|
||||
xtimer_set(&timer, BME680_TEST_PERIOD_US);
|
||||
ztimer_set(ZTIMER_MSEC, &timer, BME680_TEST_PERIOD_MS);
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -76,7 +77,7 @@ int main(void)
|
||||
/* get the duration for the measurement */
|
||||
int duration = bme680_get_duration(&dev[i]);
|
||||
/* wait for the duration */
|
||||
xtimer_msleep(duration);
|
||||
ztimer_sleep(ZTIMER_MSEC, duration);
|
||||
/* read the data */
|
||||
int res = bme680_get_data(&dev[i], &data);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_usec
|
||||
|
||||
USEPKG += u8g2
|
||||
|
||||
|
@ -70,7 +70,8 @@
|
||||
#include "periph/i2c.h"
|
||||
#endif
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "timex.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#include "u8g2.h"
|
||||
#include "u8x8_riotos.h"
|
||||
@ -200,7 +201,7 @@ int main(void)
|
||||
screen = (screen + 1) % 3;
|
||||
|
||||
/* sleep a little */
|
||||
xtimer_sleep(1);
|
||||
ztimer_sleep(ZTIMER_USEC, US_PER_SEC);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -54,7 +54,8 @@
|
||||
#include "periph/spi.h"
|
||||
#endif
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "timex.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#include "ucg.h"
|
||||
#include "ucg_riotos.h"
|
||||
@ -139,7 +140,7 @@ int main(void)
|
||||
screen = (screen + 1) % 3;
|
||||
|
||||
/* sleep a little */
|
||||
xtimer_sleep(1);
|
||||
ztimer_sleep(ZTIMER_USEC, US_PER_SEC);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user