main/nvsio.h

Sun, 10 Sep 2023 17:29:15 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 10 Sep 2023 17:29:15 +0200
changeset 37
50dbb626fbab
parent 18
12506716211c
permissions
-rw-r--r--

Version 0.4.3. Attempt to fix the sunlight overflow of the APDS9930 sensor in the private part of the esp-idf-lib. Removed some error checks from functions that always return OK. Store light sensor registers in the state record and report the values in the json result string.

/**
 * @file nvsio.h
 * @brief NVS namespace io utilities.
 */
#ifndef NVSIO_H
#define	NVSIO_H


/**
 * @brief Initilise NVS namespace and create variables if they don't exist.
 */
void nvsio_init(void);

/**
 * @brief Read 8 bit value from NVS. Create variable if new.
 * @param key The variable name in the nvs namespace.
 * @return The value or 0 if it's a new variable.
 */
uint8_t nvsio_read_u8(char *key);

/**
 * @brief Write 8 bit value to NVS. Create variable if new.
 * @param key The variable name in the nvs namespace.
 * @param val The value to store.
 */
void nvsio_write_u8(char *key, uint8_t val);

/**
 * @brief Read 32 bit value from NVS. Create variable if new.
 * @param key The variable name in the nvs namespace.
 * @return The value or 0 if it's a new variable.
 */
uint32_t nvsio_read_u32(char *key);

/**
 * @brief Write 32 bit value to NVS. Create variable if new.
 * @param key The variable name in the nvs namespace.
 * @param val The value to store.
 */
void nvsio_write_u32(char *key, uint32_t val);


#endif

mercurial