samples: boards: reel_board: mesh_badge: use DEVICE_DT_GET
Obtain flash device at compile time using DEVICE_DT_GET. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
abe3c1d3c5
commit
d3f8d75e70
1 changed files with 6 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <zephyr.h>
|
||||
#include <device.h>
|
||||
#include <devicetree.h>
|
||||
#include <drivers/gpio.h>
|
||||
#include <display/cfb.h>
|
||||
#include <sys/printk.h>
|
||||
|
@ -577,9 +578,12 @@ static int configure_leds(void)
|
|||
|
||||
static int erase_storage(void)
|
||||
{
|
||||
const struct device *dev;
|
||||
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller));
|
||||
|
||||
dev = device_get_binding(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL);
|
||||
if (!device_is_ready(dev)) {
|
||||
printk("Flash device not ready\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return flash_erase(dev, FLASH_AREA_OFFSET(storage),
|
||||
FLASH_AREA_SIZE(storage));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue