Auto initialize modules. More...
Auto initialize modules.
This feature can be enabled in any application by adding the
auto_init module to the application's
auto_init initializes any included module that provides auto-initialization capabilities. This concerns first any other included module that does not require a parameter in its init function, i.e. if the init prototype looks like this:
void MODULE_init(void). Most timer modules or simple drivers can be initialized by
auto_init. The modules will be initialized in the context of the main thread right before the main function gets called. Be aware that most modules expect to be initialized only once, so do not call a module's init function when using
auto_init unless you know what you're doing.
More complex device drivers, for example SAUL drivers or network device drivers, can also be initialized automatically using the
auto_init module. To do so, each driver implementation must provide default initialization parameters in the
DRIVER_params.h file. These parameters can be overriden from the application code in several ways (examples with the BMP180 temperature and pressure sensor oversampling parameter
CFLAGSvariable on the build command line:
CFLAGSvariable in the application
bmp180_params.hheader to the application directory and editing it there with the desired values. This file is be included first and thus the one from the driver implementation is skipped.
From low-level CPU peripheral, the default initialization parameters are defined in each board configuration that provides them.
|GNRC netif drivers auto-initialization|
|Provides auto-initialization of network device drivers via GNRC. |
|SAUL drivers auto-initialization|
|Provides auto-initialization of SAUL drivers. |