mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers: nvram_spi: use xtimer
This commit is contained in:
parent
01f03a54f1
commit
4bbc5ae4d2
@ -366,3 +366,7 @@ endif
|
||||
ifneq (,$(filter pcd8544,$(USEMODULE)))
|
||||
USEMODULE += xtimer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter nvram_spi,$(USEMODULE)))
|
||||
USEMODULE += xtimer
|
||||
endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "byteorder.h"
|
||||
#include "periph/spi.h"
|
||||
#include "periph/gpio.h"
|
||||
#include "hwtimer.h"
|
||||
#include "xtimer.h"
|
||||
|
||||
/**
|
||||
* @ingroup nvram
|
||||
@ -143,7 +143,7 @@ static int nvram_spi_write(nvram_t *dev, uint8_t *src, uint32_t dst, size_t len)
|
||||
}
|
||||
/* Release CS */
|
||||
gpio_set(spi_dev->cs);
|
||||
hwtimer_spin(NVRAM_SPI_CS_TOGGLE_TICKS);
|
||||
xtimer_spin(NVRAM_SPI_CS_TOGGLE_TICKS);
|
||||
/* Re-assert CS */
|
||||
gpio_clear(spi_dev->cs);
|
||||
/* Write command and address */
|
||||
@ -228,7 +228,7 @@ static int nvram_spi_write_9bit_addr(nvram_t *dev, uint8_t *src, uint32_t dst, s
|
||||
return status;
|
||||
}
|
||||
gpio_set(spi_dev->cs);
|
||||
hwtimer_spin(NVRAM_SPI_CS_TOGGLE_TICKS);
|
||||
xtimer_spin(NVRAM_SPI_CS_TOGGLE_TICKS);
|
||||
gpio_clear(spi_dev->cs);
|
||||
/* Write command and address */
|
||||
status = spi_transfer_reg(spi_dev->spi, cmd, addr, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user