Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5288

C/C++ • Re: Pico SDK compilation question re placement of preprocessor directives

$
0
0
The terms in CAPS (PICO_DEFAULT_I2C_SDA_PIN, GPIO_FUNC_I2C, etc.) are preprocessor macros (in this case, names for constant values).

However, puts(), i2c_init(), gpio_set_function(), and gpio_pull_up() are either C function calls or preprocessor macros which evaluate to function calls or executable code. They therefore need to be in the execution path, either in main(), or a subroutine which is called by main. Executable statements cannot be placed outside of a routine.

Statistics: Posted by Memotech Bill — Wed Jan 31, 2024 7:51 am



Viewing all articles
Browse latest Browse all 5288

Trending Articles