System Flash
- group LWESP_FLASH
System flash API.
Functions
-
lwespr_t lwesp_flash_erase(lwesp_flash_partition_t partition, uint32_t offset, uint32_t length, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Erase flash block.
- Parameters
partition – [in] Partition to do erase operation on
offset – [in] Offset from start of partition. Must be
4kB
aligned when used. Set to0
to erase full partitionlength – [in] Size to erase. Must be
4kB
aligned when used. Set to0
to erase full partitionevt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_flash_write(lwesp_flash_partition_t partition, uint32_t offset, const void *data, uint32_t length, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Write data to flash partition.
- Parameters
partition – [in] Partition to write to
offset – [in] Offset from start of partition to start writing at
data – [in] Actual data to write. Must not be
NULL
length – [in] Number of bytes to write
evt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_mfg_erase(lwesp_mfg_namespace_t mfgns, const char *key, uint32_t offset, uint32_t length, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
-
lwespr_t lwesp_mfg_write(lwesp_mfg_namespace_t mfgns, const char *key, lwesp_mfg_valtype_t valtype, const void *data, uint32_t length, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Write key-value pair into user MFG area.
Note
When writing into this section, no need to previously erase the data System is smart enough to do this for us, if absolutely necessary
- Parameters
mfgns – [in] User namespace option
key – [in] Key to write
valtype – [in] Value type to follow
data – [in] Pointer to data to write. If value type is primitive type, then pointer is copied to the local structure. This means even for non-blocking calls, user can safely use local variables for data pointers.
length – [in] Length of data to write. It only makes sense for string and binary data types, otherwise it is derived from value type parameter and can be set to
0
by userevt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_mfg_read(lwesp_mfg_namespace_t mfgns, const char *key, void *data, uint32_t btr, uint32_t offset, uint32_t *br, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Read key-value pair into user MFG area.
Note
When writing into this section, no need to previously erase the data System is smart enough to do this for us, if absolutely necessary
- Parameters
mfgns – [in] User namespace option
key – [in] Key to ead
data – [in] Pointer to data to write received data to
btr – [in] Number of bytes to read
offset – [in] Offset from partition start to read data from
br – [out] Pointer to output variable to write number of bytes read
evt_fn – [in] Callback function called when command has finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwespOK on success, member of lwespr_t enumeration otherwise
-
lwespr_t lwesp_flash_erase(lwesp_flash_partition_t partition, uint32_t offset, uint32_t length, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)