Preprocessor Configuration - Infineon/pas-co2-sensor GitHub Wiki

The src/config sources provides the C-macro level library configuration.

Through defines configuration the different modules of the library are conditionally compiled. #ifdef/#ifndef guards are added to all source files for the framework specific sources. Therefore, only the code needed is added to the binary. The main selectable parameters are:

  • Hardware Interfaces. The main hardware interfaces to interact with the PAS CO2 sensor are the Serial (UART or I2C) communication or the Pulse (PWM software or hardware) output. Therefore, up to 5 options are possible. The defines values are designed as bit masks, so from all interfaces to just a single one can be selectively enabled or disabled.

  • Logger. The entire logger and the individual software modules and/or debugging level traces can be enabled or disable via these macro group.

Config Files

The configuration folder includes 3 files:

  • pas-co2-conf-opts.hpp. All the library configuration macro define options.
  • pas-co2-conf.hpp. This is the actual configuration file.
  • pas-co2-conf-dfl.hpp. This is the default configuration. This file is included (#include) in pas-co2-conf.hpp. If any optional parameter is not defined, then the default value will be set in this file. If any user selectable mandatory configuration is not set, an error will be thrown during compilation, requesting the definition of such parameter.