ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_task_flash.h File Reference

Go to the source code of this file.

Functions

rd_status_t rt_flash_init (void)
 Initialize flash storage. More...
 
rd_status_t rt_flash_store (const uint16_t file_id, const uint16_t record_id, const void *const message, const size_t message_length)
 Store data to flash. More...
 
rd_status_t rt_flash_load (const uint16_t file_id, const uint16_t record_id, void *const message, const size_t message_length)
 Load data from flash. More...
 
rd_status_t rt_flash_free (const uint16_t file_id, const uint16_t record_id)
 Free data from flash. More...
 
rd_status_t rt_flash_gc_run (void)
 Trigger garbage collection. More...
 
bool rt_flash_busy (void)
 Check if flash is running an operation. More...
 

Detailed Description

Author
Otso Jousimaa otso@.nosp@m.ojou.nosp@m.sima..nosp@m.net
Date
2020-02-11

Store and load data to/from persistent storage. Typical usage:

err_code = rt_flash_init();
char data[] = "Hello Flash!"
err_code = rt_flash_store(1, 1, data, sizeof(data));
while(rt_flash_busy());
char load[20];
err_code = rt_flash_load(1, 1, load, sizeof(data));
while(rt_flash_busy());
err_code = rt_flash_free(1, 1);
err_code = rt_flash_gc_run();
uint32_t rd_status_t
bitfield for representing errors
#define RD_ERROR_CHECK(error, mask)
Shorthand macro for calling the rd_error_check with current file & line.
#define RD_SUCCESS
Internal Error.
bool rt_flash_busy(void)
Check if flash is running an operation.
rd_status_t rt_flash_gc_run(void)
Trigger garbage collection.
rd_status_t rt_flash_init(void)
Initialize flash storage.
rd_status_t rt_flash_free(const uint16_t file_id, const uint16_t record_id)
Free data from flash.
rd_status_t rt_flash_load(const uint16_t page_id, const uint16_t record_id, void *const message, const size_t message_length)
Load data from flash.
rd_status_t rt_flash_store(const uint16_t file_id, const uint16_t record_id, const void *const message, const size_t message_length)
Store data to flash.

Definition in file ruuvi_task_flash.h.