Skip to content

Commit

Permalink
drivers/mtd_spi_nor: fix init when only ztimer_msec is used
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Aug 31, 2023
1 parent f1df27b commit 6e290fb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/mtd_spi_nor/mtd_spi_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@

#include "byteorder.h"
#include "kernel_defines.h"
#include "macros/math.h"
#include "macros/utils.h"
#include "mtd.h"
#include "mtd_spi_nor.h"
#include "time_units.h"
#include "thread.h"

#if IS_USED(MODULE_ZTIMER_USEC)
#if IS_USED(MODULE_ZTIMER)
#include "ztimer.h"
#elif IS_USED(MODULE_XTIMER)
#include "xtimer.h"
Expand Down Expand Up @@ -451,6 +453,9 @@ static int mtd_spi_nor_power(mtd_dev_t *mtd, enum mtd_power_state power)
do {
#if IS_USED(MODULE_ZTIMER_USEC)
ztimer_sleep(ZTIMER_USEC, dev->params->wait_chip_wake_up);
#elif IS_USED(MODULE_ZTIMER_MSEC)
ztimer_sleep(ZTIMER_MSEC,
DIV_ROUND_UP(dev->params->wait_chip_wake_up, US_PER_MS));
#elif IS_USED(MODULE_XTIMER)
xtimer_usleep(dev->params->wait_chip_wake_up);
#endif
Expand Down

0 comments on commit 6e290fb

Please sign in to comment.