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

SDK • Re: troubletrouble defining a macro to replace a zero argument fn call: micros()

$
0
0
One can cover the BS, but it still stinks. :)

"#undef micros" would do nothing meaningful if it's not used in the original sources, because micros() is a function (dealt by compiler), not a preprocessor definition.

If you want to replace that function, you have to rewrite it (with or without 'inline').
'Inline' is just an optimization for speed (at a cost of size).

Or just use a text editor and use the magic Find&Replace ... or a fancy code refactoring in a useful IDE (that means not Arduino IDE).

P.S. You made me dig into BS ... again.
I've put a Arduino test in a proper debugger (which means again not Arduino IDE, but Eclipse) and it looks like those function have already been replaced (in arduino-pico) by:

Code:

  delay() for the Raspberry Pi Pico RP2040    Copyright (c) 2021 Earle F. Philhower, III <earlephilhower@yahoo.com>  ...    uint32_t millis() {        return to_ms_since_boot(get_absolute_time());    }    uint32_t micros() {        return to_us_since_boot(get_absolute_time());    }
And there are no macro conditional definitions.
I've tried to use the undef, it does absolutely nothing, as expected.

Statistics: Posted by gmx — Sat Oct 05, 2024 2:30 am



Viewing all articles
Browse latest Browse all 4997

Trending Articles