Loading...
Searching...
No Matches
Auto-initialization

Auto initialize modules. More...

Detailed Description

Auto initialize modules.

This feature can be enabled in any application by adding the auto_init module to the application's Makefile:

USEMODULE += auto_init

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 overridden from the application code in several ways (examples with the BMP180 temperature and pressure sensor oversampling parameter BMP180_PARAM_OVERSAMPLING):

CFLAGS=-DBMP180_PARAM_OVERSAMPLING=1 USEMODULE=bmp180 make BOARD=arduino-zero -C examples/default
CFLAGS += -DBMP180_PARAM_OVERSAMPLING=1

From low-level CPU peripheral, the default initialization parameters are defined in each board configuration that provides them.

Modules

 GNRC netif drivers auto-initialization
 Provides auto-initialization of network device drivers via GNRC.
 
 Multimedia driver auto-initialization
 Provides auto-initialization of Multimedia drivers.
 
 SAUL drivers auto-initialization
 Provides auto-initialization of SAUL drivers.
 
 lwIP netif drivers auto-initialization
 Provides auto-initialization of network device drivers for lwIP.
 

Files

file  auto_init_priorities.h
 Priority values of auto-initialized modules.