Constants

The config.xml file allows you to specify constants that can be used by your application. There are two types of constants, variables and pre-processor constants.

Variable constants

Variable constants are stored as global C variables in your application. When you need to access one of these variables, you must include the <dct_config.h> header file that defines all the constants available. Variable constants are typically used to configure values in libraries. For example, the SDK uses them to configure the stack space for all the threads.

    <constant type="var" name="VAR_CONSTANT" value="23" format="integer"/>

This constant can be used as follows in an application.

#include <stdio.h>
#include <dct_config.h>
void main(void) {
  printf("Constant = %d\n", DCT_CONST_APP_VAR_CONSTANT);
}

Pre-processor constants

Pre processor constants are #defined in the <dct_config.h> header file. Pre-processor constants are the easiest and most efficient way to use constants in your application.

    <constant type="preproc" name="VAR_PREPROC" value="hello world" format="string"/>

This constant can be used as follows in an application.

#include <stdio.h>
#include <dct_config.h>
void main(void) {
  printf("Constant = '%s'\n", DCT_CONST_APP_VAR_PREPROC);
}