1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #17367 from fjmolinas/pr_driver_ztimer_corner_cases

drivers: migrate xtimer64 and xtimer/ticks users to ztimer
This commit is contained in:
Francisco 2022-01-24 10:41:24 +01:00 committed by GitHub
commit b985a74894
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 85 additions and 79 deletions

View File

@ -28,7 +28,8 @@
#include "periph/spi.h"
#include "nvram-spi.h"
#include "nvram.h"
#include "xtimer.h"
#include "ztimer.h"
#include "timex.h"
#include "vfs.h"
#include "fs/devfs.h"
#include "mtd_spi_nor.h"
@ -115,7 +116,7 @@ void board_init(void)
/* NVRAM requires xtimer for timing */
xtimer_init();
ztimer_init();
/* Initialize NVRAM */
status = mulle_nvram_init();

View File

@ -66,7 +66,6 @@
#include "mutex.h"
#include "periph/gpio.h"
#include "xtimer.h"
#ifdef __cplusplus
extern "C" {

View File

@ -12,7 +12,7 @@ config MODULE_LTC4150
depends on TEST_KCONFIG
select MODULE_PERIPH_GPIO
select MODULE_PERIPH_GPIO_IRQ
select MODULE_XTIMER
select ZTIMER64_USEC
help
Driver for the Linear Tech LTC4150 Coulomb Counter (a.k.a. battery
gauge sensor or power consumption sensor).

View File

@ -1,3 +1,3 @@
FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_gpio_irq
USEMODULE += xtimer
USEMODULE += ztimer64_usec

View File

@ -22,7 +22,8 @@
#include <string.h>
#include "ltc4150.h"
#include "xtimer.h"
#include "ztimer64.h"
#include "timex.h"
#define ENABLE_DEBUG 0
#include "debug.h"
@ -44,7 +45,7 @@ static void pulse_cb(void *_dev)
dir = LTC4150_CHARGE;
}
now = xtimer_now_usec64();
now = ztimer64_now(ZTIMER64_USEC);
if (dev->params.recorders) {
assert(dev->params.recorder_data);
@ -101,7 +102,7 @@ int ltc4150_init(ltc4150_dev_t *dev, const ltc4150_params_t *params)
int ltc4150_reset_counters(ltc4150_dev_t *dev)
{
uint64_t now = xtimer_now_usec64();
uint64_t now = ztimer64_now(ZTIMER64_USEC);
if (!dev) {
return -EINVAL;

View File

@ -20,7 +20,8 @@
#include <string.h>
#include "ltc4150.h"
#include "xtimer.h"
#include "ztimer64.h"
#include "timex.h"
static void init_or_reset(ltc4150_dev_t *dev, uint64_t now_usec, void *arg);
static void pulse(ltc4150_dev_t *dev, ltc4150_dir_t dir, uint64_t now_usec,
@ -87,7 +88,7 @@ int ltc4150_last_minute_charge(ltc4150_dev_t *dev,
}
gpio_irq_disable(dev->params.interrupt);
update_ringbuffer(d, xtimer_now_usec64());
update_ringbuffer(d, ztimer64_now(ZTIMER64_USEC));
ltc4150_pulses2c(dev, charged, discharged, d->charged, d->discharged);
gpio_irq_enable(dev->params.interrupt);

View File

@ -1,4 +1,4 @@
FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_gpio_irq
FEATURES_REQUIRED += periph_spi
USEMODULE += xtimer
USEMODULE += ztimer_usec

View File

@ -19,17 +19,13 @@
#include "mutex.h"
#include "periph/gpio.h"
#include "periph/spi.h"
#include "xtimer.h"
#include "ztimer.h"
#include "thread.h"
#include "msg.h"
#define ENABLE_DEBUG 0
#include "debug.h"
#define DELAY_CS_TOGGLE_TICKS (xtimer_ticks_from_usec(DELAY_CS_TOGGLE_US))
#define DELAY_AFTER_FUNC_TICKS (xtimer_ticks_from_usec(DELAY_AFTER_FUNC_US))
#define DELAY_CHANGE_TXRX_TICKS (xtimer_ticks_from_usec(DELAY_CHANGE_TXRX_US))
#define SPI_MODE SPI_MODE_0
#define SPI_CLK SPI_CLK_400KHZ
@ -43,7 +39,7 @@ int nrf24l01p_read_reg(const nrf24l01p_t *dev, char reg, char *answer)
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
return 0;
}
@ -56,7 +52,7 @@ int nrf24l01p_write_reg(const nrf24l01p_t *dev, char reg, char write)
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
return 0;
}
@ -87,7 +83,7 @@ int nrf24l01p_init(nrf24l01p_t *dev, spi_t spi, gpio_t ce, gpio_t cs, gpio_t irq
spi_release(dev->spi);
}
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
/* Flush TX FIFIO */
status = nrf24l01p_flush_tx_fifo(dev);
@ -191,7 +187,7 @@ int nrf24l01p_on(const nrf24l01p_t *dev)
nrf24l01p_read_reg(dev, REG_CONFIG, &read);
status = nrf24l01p_write_reg(dev, REG_CONFIG, (read | PWR_UP));
xtimer_usleep(DELAY_CHANGE_PWR_MODE_US);
ztimer_sleep(ZTIMER_USEC, DELAY_CHANGE_PWR_MODE_US);
return status;
}
@ -204,7 +200,7 @@ int nrf24l01p_off(const nrf24l01p_t *dev)
nrf24l01p_read_reg(dev, REG_CONFIG, &read);
status = nrf24l01p_write_reg(dev, REG_CONFIG, (read & ~PWR_UP));
xtimer_usleep(DELAY_CHANGE_PWR_MODE_US);
ztimer_sleep(ZTIMER_USEC, DELAY_CHANGE_PWR_MODE_US);
return status;
}
@ -212,10 +208,10 @@ int nrf24l01p_off(const nrf24l01p_t *dev)
void nrf24l01p_transmit(const nrf24l01p_t *dev)
{
gpio_set(dev->ce);
xtimer_usleep(DELAY_CE_HIGH_US); /* at least 10 us high */
ztimer_sleep(ZTIMER_USEC, DELAY_CE_HIGH_US); /* at least 10 us high */
gpio_clear(dev->ce);
xtimer_spin(DELAY_CHANGE_TXRX_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_CHANGE_TXRX_US);
}
int nrf24l01p_read_payload(const nrf24l01p_t *dev, char *answer, unsigned int size)
@ -223,7 +219,7 @@ int nrf24l01p_read_payload(const nrf24l01p_t *dev, char *answer, unsigned int si
/* Acquire exclusive access to the bus. */
spi_acquire(dev->spi, dev->cs, SPI_MODE, SPI_CLK);
spi_transfer_regs(dev->spi, dev->cs, CMD_R_RX_PAYLOAD, NULL, answer, size);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
/* Release the bus for other threads. */
spi_release(dev->spi);
@ -254,12 +250,12 @@ void nrf24l01p_get_id(const nrf24l01p_t *dev, unsigned int *pid)
void nrf24l01p_start(const nrf24l01p_t *dev)
{
gpio_set(dev->ce);
xtimer_usleep(DELAY_CE_START_US);
ztimer_sleep(ZTIMER_USEC, DELAY_CE_START_US);
}
void nrf24l01p_stop(const nrf24l01p_t *dev)
{
xtimer_spin(DELAY_CS_TOGGLE_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_CS_TOGGLE_US);
gpio_clear(dev->ce);
}
@ -273,7 +269,7 @@ int nrf24l01p_preload(const nrf24l01p_t *dev, char *data, unsigned int size)
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
return 0;
}
@ -291,7 +287,7 @@ int nrf24l01p_set_address_width(const nrf24l01p_t *dev, nrf24l01p_aw_t aw)
char aw_setup;
nrf24l01p_read_reg(dev, REG_SETUP_AW, &aw_setup);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
switch (aw) {
case NRF24L01P_AW_3BYTE:
@ -367,7 +363,7 @@ int nrf24l01p_set_tx_address(const nrf24l01p_t *dev, const uint8_t *saddr, unsig
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
return (int)length;
}
@ -394,7 +390,7 @@ int nrf24l01p_set_tx_address_long(const nrf24l01p_t *dev, uint64_t saddr, unsign
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
return (int)length;
}
@ -411,7 +407,7 @@ uint64_t nrf24l01p_get_tx_address_long(const nrf24l01p_t *dev)
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
for (int i = 0; i < INITIAL_ADDRESS_WIDTH; i++) {
saddr_64 |= (((uint64_t) addr_array[i]) << (8 * (INITIAL_ADDRESS_WIDTH - i - 1)));
@ -461,7 +457,7 @@ int nrf24l01p_set_rx_address(const nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe, c
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
/* Enable this pipe */
nrf24l01p_enable_pipe(dev, pipe);
@ -529,7 +525,7 @@ uint64_t nrf24l01p_get_rx_address_long(const nrf24l01p_t *dev, nrf24l01p_rx_pipe
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
for (int i = 0; i < INITIAL_ADDRESS_WIDTH; i++) {
saddr_64 |= (((uint64_t) addr_array[i]) << (8 * (INITIAL_ADDRESS_WIDTH - i - 1)));
@ -576,7 +572,7 @@ int nrf24l01p_get_status(const nrf24l01p_t *dev)
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
return (int)status;
}
@ -633,7 +629,7 @@ int nrf24l01p_set_txmode(const nrf24l01p_t *dev)
conf &= ~(PRIM_RX);
status = nrf24l01p_write_reg(dev, REG_CONFIG, conf);
xtimer_usleep(DELAY_CHANGE_TXRX_US);
ztimer_sleep(ZTIMER_USEC, DELAY_CHANGE_TXRX_US);
return status;
}
@ -654,7 +650,7 @@ int nrf24l01p_set_rxmode(const nrf24l01p_t *dev)
nrf24l01p_start(dev);
xtimer_usleep(DELAY_CHANGE_TXRX_US);
ztimer_sleep(ZTIMER_USEC, DELAY_CHANGE_TXRX_US);
return status;
}
@ -893,7 +889,7 @@ int nrf24l01p_flush_tx_fifo(const nrf24l01p_t *dev)
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
return 0;
}
@ -906,7 +902,7 @@ int nrf24l01p_flush_rx_fifo(const nrf24l01p_t *dev)
/* Release the bus for other threads. */
spi_release(dev->spi);
xtimer_spin(DELAY_AFTER_FUNC_TICKS);
ztimer_spin(ZTIMER_USEC, DELAY_AFTER_FUNC_US);
return 0;
}

View File

@ -11,4 +11,4 @@ config MODULE_NVRAM_SPI
depends on TEST_KCONFIG
select MODULE_NVRAM
select MODULE_PERIPH_SPI
select MODULE_XTIMER
select ZTIMER_USEC

View File

@ -1,3 +1,3 @@
FEATURES_REQUIRED += periph_spi
USEMODULE += nvram
USEMODULE += xtimer
USEMODULE += ztimer_usec

View File

@ -14,7 +14,7 @@
#include "byteorder.h"
#include "periph/spi.h"
#include "periph/gpio.h"
#include "xtimer.h"
#include "ztimer.h"
/**
* @ingroup drivers_nvram
@ -42,7 +42,7 @@ typedef enum {
/** @brief Delay to wait between toggling CS pin, on most chips this can probably be
* removed. */
#define NVRAM_SPI_CS_TOGGLE_TICKS xtimer_ticks_from_usec(1)
#define NVRAM_SPI_CS_TOGGLE_US 1
/**
* @brief Copy data from system memory to NVRAM.
@ -140,7 +140,7 @@ static int nvram_spi_write(nvram_t *dev, const uint8_t *src, uint32_t dst, size_
/* Enable writes */
spi_transfer_byte(spi_dev->spi, spi_dev->cs, false, NVRAM_SPI_CMD_WREN);
/* Make sure we have a minimum gap between transfers */
xtimer_spin(NVRAM_SPI_CS_TOGGLE_TICKS);
ztimer_spin(ZTIMER_USEC, NVRAM_SPI_CS_TOGGLE_US);
/* Write command and address */
spi_transfer_byte(spi_dev->spi, spi_dev->cs, true, NVRAM_SPI_CMD_WRITE);
spi_transfer_bytes(spi_dev->spi, spi_dev->cs, true,
@ -200,7 +200,7 @@ static int nvram_spi_write_9bit_addr(nvram_t *dev, const uint8_t *src, uint32_t
/* Enable writes */
spi_transfer_byte(spi_dev->spi, spi_dev->cs, false, NVRAM_SPI_CMD_WREN);
/* Insert needed delay between transactions */
xtimer_spin(NVRAM_SPI_CS_TOGGLE_TICKS);
ztimer_spin(ZTIMER_USEC, NVRAM_SPI_CS_TOGGLE_US);
/* Write command and address */
spi_transfer_byte(spi_dev->spi, spi_dev->cs, true, cmd);
spi_transfer_byte(spi_dev->spi, spi_dev->cs, true, addr);

View File

@ -12,7 +12,7 @@ config MODULE_PIR
depends on TEST_KCONFIG
select MODULE_PERIPH_GPIO
select MODULE_PERIPH_GPIO_IRQ
select MODULE_XTIMER
select ZTIMER64_USEC
config HAVE_PIR
bool

View File

@ -1,3 +1,3 @@
FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_gpio_irq
USEMODULE += xtimer
USEMODULE += ztimer64_usec

View File

@ -24,7 +24,7 @@
#include "irq.h"
#include "thread.h"
#include "msg.h"
#include "xtimer.h"
#include "ztimer64.h"
#define ENABLE_DEBUG 0
#include "debug.h"
@ -50,7 +50,7 @@ int pir_init(pir_t *dev, const pir_params_t *params)
dev->active = false;
dev->accum_active_time = 0;
dev->start_active_time = 0;
dev->last_read_time = xtimer_now_usec64();
dev->last_read_time = ztimer64_now(ZTIMER64_USEC);
gpio_mode_t gpio_mode;
if (dev->p.active_high) {
@ -74,7 +74,7 @@ pir_event_t pir_get_status(const pir_t *dev)
int pir_get_occupancy(pir_t *dev, int16_t *occup) {
int irq_state = irq_disable();
uint64_t now = xtimer_now_usec64();
uint64_t now = ztimer64_now(ZTIMER64_USEC);
uint64_t total_time = now - dev->last_read_time;
if (total_time == 0) {
irq_restore(irq_state);
@ -145,7 +145,7 @@ static void pir_callback(void *arg)
DEBUG("pir_callback: %p\n", arg);
pir_t *dev = (pir_t*) arg;
bool pin_now = gpio_read(dev->p.gpio);
uint64_t now = xtimer_now_usec64();
uint64_t now = ztimer64_now(ZTIMER64_USEC);
/* We were busy counting */
if (dev->active) {

View File

@ -10,4 +10,4 @@ config MODULE_SI1133
depends on HAS_PERIPH_I2C
depends on TEST_KCONFIG
select MODULE_PERIPH_I2C
select MODULE_XTIMER
select ZTIMER_USEC

View File

@ -1,2 +1,2 @@
USEMODULE += xtimer
USEMODULE += ztimer_usec
FEATURES_REQUIRED += periph_i2c

View File

@ -24,7 +24,8 @@
#include <stdint.h>
#include <stdbool.h>
#include "xtimer.h"
#include "timex.h"
#include "ztimer.h"
#include "periph/i2c.h"
@ -86,7 +87,7 @@ static int _si1133_run_command(si1133_t *dev, uint8_t command)
if (command == SI1133_CMD_FORCE) {
/* Wait for the expected force acquisition time. */
xtimer_usleep(_si1133_force_time_us(dev));
ztimer_sleep(ZTIMER_USEC, _si1133_force_time_us(dev));
}
if (command == SI1133_CMD_RESET_SW) {
@ -94,7 +95,7 @@ static int _si1133_run_command(si1133_t *dev, uint8_t command)
dev->cmd_counter = 0x0f;
/* Reset command puts the device in "Initialization Mode" which requires
* us to wait until the device is ready. */
xtimer_msleep(SI1133_STARTUP_TIME_MS);
ztimer_sleep(ZTIMER_USEC, SI1133_STARTUP_TIME_MS * US_PER_MS);
}
else if (command == SI1133_CMD_RESET_CMD_CTR) {
/* The reset cmd_counter command, well, resets it to 0. */
@ -106,7 +107,7 @@ static int _si1133_run_command(si1133_t *dev, uint8_t command)
}
uint8_t new_cmd_ctr;
xtimer_ticks32_t start_time;
ztimer_now_t start_time;
bool retry = false;
while (1) {
ret = i2c_read_reg(dev->i2c_dev, dev->address, SI1133_REG_RESPONSE0,
@ -142,22 +143,21 @@ static int _si1133_run_command(si1133_t *dev, uint8_t command)
}
/* The command didn't yet finish in this case so it should be in running
* state and we need to retry the loop with a timeout. This avoids
* calling xtimer for commands that are immediate. */
* calling ztimer for commands that are immediate. */
if (retry) {
if (xtimer_usec_from_ticks(xtimer_diff(xtimer_now(), start_time))
> SI1133_COMMAND_TIMEOUT_USEC) {
if (ztimer_now(ZTIMER_USEC) - start_time > SI1133_COMMAND_TIMEOUT_USEC) {
DEBUG("[si1133] Command 0x%.2x timeout.\n", (unsigned)command);
return SI1133_ERR_LOGIC;
}
}
else {
retry = true;
start_time = xtimer_now();
start_time = ztimer_now(ZTIMER_USEC);
}
}
if (retry) {
DEBUG("[si1133] Command overtime: %" PRIu32 " us.\n",
xtimer_usec_from_ticks(xtimer_diff(xtimer_now(), start_time)));
ztimer_now(ZTIMER_USEC) - start_time);
}
return SI1133_OK;
}
@ -320,7 +320,7 @@ si1133_ret_code_t si1133_init(si1133_t *dev, const si1133_params_t *params)
/* After leaving "Off Mode" the SI1133 enters an "Initialization Mode" for
* a period of time in which it can't be reached over I2C. After this time
* the device will be in Standby Mode. */
xtimer_msleep(SI1133_STARTUP_TIME_MS);
ztimer_sleep(ZTIMER_USEC, SI1133_STARTUP_TIME_MS * US_PER_MS);
i2c_acquire(params->i2c_dev);

View File

@ -4,6 +4,7 @@ BOARD ?= msba2
USEMODULE += fmt_table
USEMODULE += ltc4150
USEMODULE += ztimer_usec
include $(RIOTBASE)/Makefile.include

View File

@ -25,7 +25,8 @@
#include "led.h"
#include "ltc4150.h"
#include "thread.h"
#include "xtimer.h"
#include "ztimer.h"
#include "timex.h"
typedef struct {
uint64_t last_usec;
@ -96,8 +97,7 @@ static void pulse_cb(ltc4150_dev_t *dev, ltc4150_dir_t dir, uint64_t now_usec,
*/
static void spin(uint32_t seconds)
{
uint32_t till = xtimer_now_usec() + US_PER_SEC * seconds;
while (xtimer_now_usec() < till) { }
ztimer_spin(ZTIMER_USEC, US_PER_SEC * seconds);
}
/**
@ -110,14 +110,14 @@ static void *busy_thread(void *arg)
/* one minute of ~0% CPU usage */
LED0_OFF;
LED1_OFF;
xtimer_sleep(60);
ztimer_sleep(ZTIMER_USEC, 60 * US_PER_SEC);
change_of_load_level = 1;
/* one minute of ~50% CPU usage */
for (unsigned i = 0; i < 30; i++) {
LED0_OFF;
LED1_OFF;
xtimer_sleep(1);
ztimer_sleep(ZTIMER_USEC, 1 * US_PER_SEC);
LED0_ON;
LED1_ON;
spin(1);

View File

@ -3,7 +3,7 @@ include ../Makefile.tests_common
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
USEMODULE += xtimer
USEMODULE += ztimer_usec
USEMODULE += nrf24l01p
# set default device parameters in case they are undefined

View File

@ -41,7 +41,7 @@
#include "nrf24l01p_settings.h"
#include "periph/spi.h"
#include "periph/gpio.h"
#include "xtimer.h"
#include "ztimer.h"
#include "shell.h"
#include "shell_commands.h"
#include "thread.h"
@ -231,7 +231,7 @@ int cmd_send(int argc, char **argv)
/* trigger transmitting */
nrf24l01p_transmit(&nrf24l01p_0);
/* wait while data is pysically transmitted */
xtimer_usleep(DELAY_DATA_ON_AIR);
ztimer_sleep(ZTIMER_USEC, DELAY_DATA_ON_AIR);
/* get status of the transceiver */
status = nrf24l01p_get_status(&nrf24l01p_0);
if (status < 0) {

View File

@ -1,7 +1,7 @@
include ../Makefile.tests_common
USEMODULE += nvram_spi
USEMODULE += xtimer
USEMODULE += ztimer_usec
# set default device parameters in case they are undefined
TEST_NVRAM_SPI_DEV ?= SPI_DEV\(0\)

View File

@ -1,4 +1,4 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_NVRAM_SPI=y
CONFIG_MODULE_XTIMER=y
CONFIG_ZTIMER_USEC=y

View File

@ -23,7 +23,8 @@
#include <ctype.h>
#include "board.h"
#include "xtimer.h"
#include "ztimer.h"
#include "timex.h"
#include "periph/spi.h"
#include "nvram-spi.h"
@ -137,7 +138,7 @@ int main(void)
puts("!!! This test will erase everything on the NVRAM !!!");
puts("!!! Unplug/reset/halt device now if this is not acceptable !!!");
puts("Waiting for 10 seconds before continuing...");
xtimer_sleep(start_delay);
ztimer_sleep(ZTIMER_USEC, start_delay * US_PER_SEC);
puts("Reading current memory contents...");
for (i = 0; i < TEST_NVRAM_SPI_SIZE; ++i) {

View File

@ -7,5 +7,6 @@ BOARD_INSUFFICIENT_MEMORY := \
atmega328p-xplained-mini \
nucleo-f031k6 \
nucleo-l011k4 \
samd10-xmini \
stm32f030f4-demo \
#

View File

@ -23,7 +23,8 @@
#include <stdio.h>
#include "thread.h"
#include "xtimer.h"
#include "timex.h"
#include "ztimer.h"
#include "pir.h"
#include "pir_params.h"
@ -76,7 +77,7 @@ int main(void)
while (1) {
printf("Status: %s\n", pir_get_status(&dev) == PIR_STATUS_INACTIVE ?
"inactive" : "active");
xtimer_usleep(1000 * 1000);
ztimer_sleep(ZTIMER_USEC, 1 * US_PER_SEC);
}
#else
thread_create(

View File

@ -2,6 +2,5 @@ include ../Makefile.tests_common
# required modules
USEMODULE += si1133
USEMODULE += xtimer
include $(RIOTBASE)/Makefile.include

View File

@ -1,4 +1,3 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_SI1133=y
CONFIG_MODULE_XTIMER=y

View File

@ -23,7 +23,6 @@
#include "si1133.h"
#include "si1133_params.h"
#include "xtimer.h"
#include "board.h"
/* Helper macro to define _si1133_strerr */

View File

@ -0,0 +1,7 @@
# mulle will always select ztimer through requiring nvram_spi module
# because of order of inclusion 'make' depency resolution will still select
# xtimer while 'Kconfig' wont, so early require 'ztimer_usec'
# for 'make' to avoid this
ifneq (,$(filter mulle,$(BOARD)))
USEMODULE += ztimer_usec
endif