Skip to content

issue with #ifdef NUMOF set to 0  #7639

@dylad

Description

@dylad

While addressing some comments from @lebrush for #7588 I noticed an issue.
In fact, we use a common struct in order to init peripheral driver within periph_conf.h file
NUMOF are defined using sizeof(struct) / sizeof(element). This line is fine but only process by compiler. So we cannot use #if NUMOF.
The problem is : if the board does not define this peripheral (e.g NUMOF = 0) AND the driver uses mutexes (mutex_t locks[NUMOF]) this line will failed to compile which is not the desired behaviour. We want the driver to be disabled.
(see sam0 i2c driver or stm32_common spi driver).

Maybe someone has an idea to solve this ? :)

Metadata

Metadata

Assignees

Labels

Type: questionThe issue poses a question regarding usage of RIOT

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions