adafruit / Adafruit_nRF52_Arduino

Adafruit code for the Nordic nRF52 BLE SoC on Arduino
Other
606 stars 492 forks source link

LittleFS boot_count example #701

Closed milador closed 2 years ago

milador commented 2 years ago

Operating System

Windows 10

IDE version

Arduino 1.8.16

Board

Feather nRF52840 Sense

BSP version

1.1.0

Sketch

The boot_count example from littlefs readme file.

What happened ?

No information on how to implement block device operations and the main configuration. Changed user_provided_block_device_read to lfs_bd_read from lfs.h and I am getting errors .

error: 'lfs_bd_read' was not declared in this scope; did you mean 'lfs_dir_read'?

I would like to read and write to the flash.

How to reproduce ?

Debug Log

No response

Screenshots

No response

hathach commented 2 years ago

the LFS is already used to manage bonding, there is an higher library that abstract the LFS API to familiar SD file APII

you could follow its example there

milador commented 2 years ago

Can it be used to achieve something similar to EEPROM or FlashStorage? I basically want to read and write variables instead of the intire 128 bytes block of data every time. Thanks

hathach commented 2 years ago

yes, it does, check out its example

milador commented 2 years ago

@hathach Thanks for pointing me toward right direction.I followed the example you provided. But can't figure out how to read and write without creating a file. I must create a file for this approach , right? I basically need to write few integers as device configuration.

hathach commented 2 years ago

LFS is a file system, everything is a file. you should use raw flash API if it is not what you are looking for.

milador commented 2 years ago

@hathach I see, any example for raw flash API read/write ? Something like flash_nrf5x_write(addr, buffer, size) ?

hathach commented 2 years ago

For questions, please post it on the adafruit support forum. There is more people there to help you out, github is mostly for troubleshooting