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

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

$
0
0

Yeah - that is hard to imagine - for sure... perhaps even silly. :)
Not so silly. The intended use with the SDK is that you define a board file that defines all your pin usage; a board that uses all the pins for other purposes may not declare any for I2C.

The Pico examples have top-level makefiles to build the whole lot in one go. A user might well want to go "let's build all of the pico-examples for my new board". So it's important for the pico examples to tolerate the I2C pins being undefined rather than stop with an error.

Obviously in your own code if it's specific to your board and I2C is the whole purpose of the code in question you might not bother. But if it's a minor function - say your board is a video generator, and the I2C is just to configure the video DAC - you might want to do something similar. Maybe you do a version 2 of your board with a different video DAC that now has SPI rather than I2C. Just change the board file and your code compiles for both.

Statistics: Posted by arg001 — Tue Feb 06, 2024 8:37 am



Viewing all articles
Browse latest Browse all 5207

Trending Articles