In this blog entry I will present the mmapGpio class that provides basic access to all the GPIO’s on the RPI’s 26-pin header using direct register access. The advantage of this approach to GPIO control is that one can bypass Linux and talk directly with the GPIO registers which enables much faster GPIO toggling speeds. Using this approach I was able to get GPIO toggling speeds that exceed 25MHz!!!! That’s much faster than the toggling speeds that can be achieved using the safer but slower SYSFS approach to GPIO control.
The mmapGpio class is intentionally designed to be simple but useful. A great feature of this class is that a single instance can be used to control the all the RPI’s GPIOs. The mmapGpio class with two examples and makefiles can be downloaded from here.
Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.