> For the complete documentation index, see [llms.txt](https://irnas.gitbook.io/opencollar/-MDJCI9OmpOqWrQzjNIR/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://irnas.gitbook.io/opencollar/-MDJCI9OmpOqWrQzjNIR/firmware/settings-module/auto-generated-files/settings-def.md).

# Settings def

Auto-generated files settings\_def.h and settings\_def.c containing all settings defined in settings.json file and functions for getting and setting values.

## settings\_def.h

### Defines

#### SETTING\_TYPE(\_id) TYPE\_##\_id

Returns data type for setting with specified ID.

#### SETTINGS\_STRUCT(\_id) STRUCT\_##\_id

Returns value struct based on setting ID.&#x20;

### Main settings

`main_settings` struct is auto-generated to contain all settings as defined in settings.json file. In addition to value structs containing settings, it contains:

* n\_settings - number of settings
* settings\_id - array containing all settings ids
* settings\_length - array containing all settings lengths

### Global variables

`Main_settings` is global `main_settings` struct, accessible in all threads and modules that contains all settings data.&#x20;

`Settings_defines` is global `settings_defines` struct , accessible in all threads and modules that contains settings for receiving and sending settings.&#x20;

### Functions

`void *get_setting_struct_by_id(uint8_t id)` - returns setting value, provided ID of setting.&#x20;

`int set_setting_value_by_id(uint8_t id, uint8_t *data, uint8_t len)` - sets value of setting, provided setting id, new value in form of a byte array and its length. Function returns 0 if ok and -1 if error in provided length.&#x20;

## settings\_def.c

For all settings defined in settings.json, structs of appropriate type are auto-generated and initialised with provided data. `Main_settings` struct is initialised with generated setting structures.&#x20;

Described functions definitions are auto-generated.
