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

C/C++ • Re: Example of GPIO use with Linux only (no third party libraries)

$
0
0
Left me scratching my head as well. When you get old enough that your vision starts to go -- you just chuckle at those responses. I was surprised when diving into the example - which usually ends up with me reading the header files - to find that Linus had even been digging around in the gpio peripheral code to come up with different versions. But it makes sense. There has been a great deal of demand for Linux on microcomputers, not just the Pi, so all the hardware peripheral code has undergone review and update in the past few years.

The irony was originally moving from the deprecated WiringPi -- only to find a deprecated part of the gpio ioctl code (which I'd wager probably had something to do with interest in maintaining WiringPi waning). I first found the GPIO V2 interface a bit daunting -- where did they hide all the pieces of V1 and what changes do I need to make to use it? Then having taken the time to wade through V2, I actually like. Specifically the gpio_v2_line_values .bits and .mask bitmaps used to set one or more of multiple gpio lines configured for access. Quite a bit more flexible than the V1 gpiohandle_data array.

Statistics: Posted by drankinatty — Tue May 07, 2024 9:44 pm



Viewing all articles
Browse latest Browse all 4803

Trending Articles