arrow-left

All pages
gitbookPowered by GitBook
1 of 5

Loading...

Loading...

Loading...

Loading...

Loading...

Values def

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

hashtag
values_def.h

hashtag
Main values

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

  • n_values - number of values

  • values_id - array containing all values ids

  • values_length - array containing all values lengths

Values are defined using same values structs as are used for settings and defined in settings_types.h.

hashtag
Global variables

Main_values is global main_values struct, accessible in all threads and modules that contains all tracker functionality values.

Values_settings is global values_settings struct , accessible in all threads and modules that contains settings for receiving and sending values.

hashtag
Functions

void *get_value_struct_by_id(uint8_t id) - returns value struct, provided ID of value.

int get_value_by_id(uint8_t id, uint8_t *data) - returns value from the value struct, provided ID of value.

int set_value_by_id(uint8_t id, uint8_t *data, uint8_t len) - sets value, provided value id, new value in form of a byte array and its length. Function returns 0 if ok and -1 if error in provided length.

hashtag
values_def.c

For all values defined in settings.json, structs of appropriate type are auto-generated and initialised with provided data. Main_values struct is initialised with generated values structures.

Described functions definitions are auto-generated.

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.

hashtag
settings_def.h

hashtag
Defines

hashtag
SETTING_TYPE(_id) TYPE_##_id

Returns data type for setting with specified ID.

hashtag
SETTINGS_STRUCT(_id) STRUCT_##_id

Returns value struct based on setting ID.

hashtag
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

hashtag
Global variables

Main_settings is global main_settings struct, accessible in all threads and modules that contains all settings data.

Settings_defines is global settings_defines struct , accessible in all threads and modules that contains settings for receiving and sending settings.

hashtag
Functions

void *get_setting_struct_by_id(uint8_t id) - returns setting value, provided ID of setting.

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.

hashtag
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.

Described functions definitions are auto-generated.

Messages def

Auto-generated files messages_def.h and messages_def.c containing all message forms as defined in settings.json file.

hashtag
messages_def.h

hashtag
Defines

Auto-generated defines for all messages ID-s. Based on message ID, appropriate message is composed and returend in firmware. All defines are of the form MSG_XXX_ID.

hashtag
Main messages

main_messages struct is auto-generated to contain all messages of cmd_message struct type as defined in settings.json file. In addition to message structs containing different message forms, it contains:

  • n_values - number of values

  • messages_id - array containing all messages ids

  • messages_length - array containing all messages lengths

hashtag
Global variables

Main_messages is global main_messages struct, accessible in all threads and modules that contains all defined message types.

messages_port - array containing all port numbers on which message is sent

Auto-generated files

Most files, containing settings, values, commands and messages data and forms are auto-generated at build time, as they depend on Settings.json file and are dependent on specific tracker type.

Python parser py2h.py and validation script validate_data.py are used to convert settings.json file to c files.

In particular the following files are generated:

  • hardware_def.h - containing only definitions from "hardware" field

  • settings_def.h and settings_def.c - containing settings structure and auto-generated functions for access and writing to structure

  • commands_def.h and commands_def.c - commands defines and settings

  • values_def.h and values_def.c - containing main values structure and auto-generated functions for access and writing to structure

  • messages_def.h and messages_def.c - message defines and messages

All auto-generated files are equipped with /* AUTOGENERATED FILE - DO NOT MODIFY! */ comment. Sections below describe content of each generated file and helping files.

Commands def

Auto-generated files commands_def.h and commands_def.c containing all commands defined in settings.json file.

hashtag
commands_def.h

hashtag
Defines

Auto-generated defines for all command ID-s. Based on command ID, command is executed in firmware

hashtag
Global variables

command_settings, containing commands message port define.