raspberrypi / pico-sdk

BSD 3-Clause "New" or "Revised" License
3.26k stars 838 forks source link

Allow disabling pico_stdio function wrapping #1635

Open gemarcano opened 4 months ago

gemarcano commented 4 months ago

This PR copies the approach used by pico_printf and applies it to pico_stdio to allow a developer to opt out of stdio printf/putchar/etc. wrappers. This is done with the use of a new function pico_set_stdio_implementation which works identically to pico_set_printf_implementation from pico_printf.

This enables a developer to opt out of stdio wrappers around the following functions:

Additionally, in pico_stdio's stdio.c, some additional #if/#endif are applied to shut up compiler warnings about unused functions when pico_printf compiler implementation is in use.

Fixes #1634

peterharperuk commented 4 months ago

Looks reasonable as far as I can see

gemarcano commented 4 months ago

I noticed a useless newline I added in stdio.c, so I just took that out. No other changes with the update.