IOT Matrix Display
Loading...
Searching...
No Matches
module_config.c File Reference
#include "module_config.h"
#include <wchar.h>
#include <zephyr/drivers/flash.h>
#include <zephyr/fs/nvs.h>
#include <zephyr/logging/log.h>
#include <zephyr/storage/flash_map.h>
+ Include dependency graph for module_config.c:

Macros

#define NVS_PARTITION   storage_partition
 
#define NVS_PARTITION_DEVICE   FIXED_PARTITION_DEVICE(NVS_PARTITION)
 
#define NVS_PARTITION_OFFSET   FIXED_PARTITION_OFFSET(NVS_PARTITION)
 
#define FS_NUMBER_OF_FLASH_SECTORS   3U
 
#define CHECK_ITEM_ID(id)
 

Functions

 LOG_MODULE_REGISTER (module_config, CONFIG_LOG_DEFAULT_LEVEL)
 
int8_t module_configInit (void)
 initialise the configuration module
 
int8_t module_configCreate (module_configItemID_t item_id, uint8_t length, void *buff, module_configFlags_t flags)
 creates a config item
 
int8_t module_configRead (module_configItemID_t item_id, uint8_t length, void *buff)
 reads an item from the config into the buffer provided
 
int8_t module_configUpdate (module_configItemID_t item_id, uint8_t length, void *buff)
 updates a config item
 
int8_t module_configDelete (module_configItemID_t item_id)
 deletes a config item
 

Macro Definition Documentation

◆ CHECK_ITEM_ID

#define CHECK_ITEM_ID ( id)
Value:
if (id >= CONFIG_ITEM_MAX) { \
LOG_ERR("Bad item ID: %d\n", id); \
return -EINVAL; \
}

Function Documentation

◆ module_configCreate()

int8_t module_configCreate ( module_configItemID_t item_id,
uint8_t length,
void * buff,
module_configFlags_t flags )

creates a config item

Parameters
typemodule_configItemID_t which config item to write
lengthlength of item which will be writeen
buffvoid buffer with item data to write
flagsbit field of flags to set for item
Returns
0 on success or -errno on failure

◆ module_configDelete()

int8_t module_configDelete ( module_configItemID_t item_id)

deletes a config item

Parameters
itemconfig item to delete
Returns
0 on success or -errno on failure

◆ module_configInit()

int8_t module_configInit ( void )

initialise the configuration module

Returns
0 on success or -errno on failure

◆ module_configRead()

int8_t module_configRead ( module_configItemID_t item_id,
uint8_t length,
void * buff )

reads an item from the config into the buffer provided

Parameters
typemodule_configItemID_t which config item to read
lengthlength of item to read
buffvoid buffer to read the item data into
Returns
0 on success or -errno on failure

◆ module_configUpdate()

int8_t module_configUpdate ( module_configItemID_t item_id,
uint8_t length,
void * buff )

updates a config item

Parameters
typemodule_configItemID_t which config item to write
lengthlength of item which will be writen
buffvoid buffer with item data to write
Returns
0 on success or -errno on failure