Modules | Functions
Functions
SYSTEM » Non-Volatile Data Storage

## Modules
| Local Flash Functions

## Functions
uint8_t | nvds_init (uint32_t start_addr, uint8_t sectors)
| Initialize the sectors for NVDS. More...
uint8_t | nvds_get (NvdsTag_t tag, uint16_t *p_len, uint8_t *p_buf)
| Read data from NVDS. More...
uint8_t | nvds_put (NvdsTag_t tag, uint16_t len, const uint8_t *p_buf)
| Write data to NVDS. If the tag does not exist, create one. More...
uint8_t | nvds_del (NvdsTag_t tag)
| Delete a tag in NVDS. More...
uint16_t | nvds_tag_length (NvdsTag_t tag)
| Get the length of a tag in NVDS. More...

## Detailed Description

## Function Documentation

## ◆ nvds_del()

uint8_t nvds_del | ( | NvdsTag_t | tag | ) |

Delete a tag in NVDS.

Parameters

  [in] | tag | The tag to be deleted.

Returns
  NVDS_SUCCESS: If the deletion is successful.
  Error code in NVDS_STATUS if not successful.

## ◆ nvds_get()

uint8_t nvds_get | ( | NvdsTag_t | tag,
|  | uint16_t * | p_len,
|  | uint8_t * | p_buf
| ) |  |

Read data from NVDS.

Parameters

  [in] | tag | Valid NVDS item tag.
  [in,out] | p_len | Pointer to the length of data.
  [out] | p_buf | Data is read into the buffer.

Returns
  NVDS_SUCCESS if successful.
  error code in NVDS_STATUS if not successful.

## ◆ nvds_init()

uint8_t nvds_init | ( | uint32_t | start_addr,
|  | uint8_t | sectors
| ) |  |

Initialize the sectors for NVDS.

Note
  NVDS locates in the last sector of Flash.

Parameters

  [in] | start_addr | Start address of NVDS area. If the value equals zero, NVDS area will locate in the last sector(s) in flash memory. If the value does not equal zero, it must be sector-aligned.
  [in] | sectors | The number of sectors.

Returns
  NVDS_SUCCESS if successful.
  error code in NVDS_STATUS if not successful.

## ◆ nvds_put()

uint8_t nvds_put | ( | NvdsTag_t | tag,
|  | uint16_t | len,
|  | const uint8_t * | p_buf
| ) |  |

Write data to NVDS. If the tag does not exist, create one.

Parameters

  [in] | tag | Valid NVDS item tag.
  [in] | len | Length of data to be written, the max length of data is 1024 bytes.
  [in] | p_buf | Data to be written.

Returns
  NVDS_SUCCESS: if successful.
  error code in NVDS_STATUS if not successful.

## ◆ nvds_tag_length()

uint16_t nvds_tag_length | ( | NvdsTag_t | tag | ) |

Get the length of a tag in NVDS.

Parameters

  [in] | tag | The tag to get the length.

Returns
  length: if tag exists.
  0: if tag does not exist.