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

General • Re: GPIO pins dynamically set as input or output within C program?

$
0
0
This is certainly possible. gpio_set_dir() is the function to change a pin direction; you can call it at any time.

The SDK functions for GPIO control are documented here: https://www.raspberrypi.com/documentati ... dware_gpio

The things you can do with them are pretty much identical to any other microcontroller out there. Any existing code you have should be easily ported.

The Pico/RP2040 also has the PIO unit which is a much more powerful (high speed) way of implementing the kind of state-machine logic you are talking about, but it does take quite a lot of learning, and sometimes lateral thinking to get the best out of it.

Statistics: Posted by arg001 — Thu Feb 08, 2024 11:57 am



Viewing all articles
Browse latest Browse all 4844

Trending Articles