I tend to call a function with void return a "subroutine". Old Fortran habit.1. When you say "subroutine", could that be a function; e.g. 'void preproc (void) { }') ??
I am not quite clear what you mean by "under a preprocessor directive". If you are referring to the use of #if !defined..., then yes somebody has made the decision to have a run-time error message rather than compile-time. It could perhaps be written something like:2. Isn't it true that someone made a choice to include these "fn calls, preprocessor macros, etc" under a preprocessor directive? I mean, there must be another way to do this - is that not true?
Code:
#if !defined(i2c_default) || !defined(PICO_DEFAULT_I2C_SDA_PIN) || !defined(PICO_DEFAULT_I2C_SCL_PIN)#error i2c/bus_scan example requires a board with I2C pins#endifvoid main (void) { // This example will use I2C0 on the default SDA and SCL pins (GP4, GP5 on a Pico) i2c_init(i2c_default, 100 * 1000); gpio_set_function(PICO_DEFAULT_I2C_SDA_PIN, GPIO_FUNC_I2C); gpio_set_function(PICO_DEFAULT_I2C_SCL_PIN, GPIO_FUNC_I2C); gpio_pull_up(PICO_DEFAULT_I2C_SDA_PIN); gpio_pull_up(PICO_DEFAULT_I2C_SCL_PIN); // Make the I2C pins available to picotool bi_decl(bi_2pins_with_func(PICO_DEFAULT_I2C_SDA_PIN, PICO_DEFAULT_I2C_SCL_PIN, GPIO_FUNC_I2C));
Statistics: Posted by Memotech Bill — Wed Jan 31, 2024 8:36 am