Version 0.9.3 of PyBBIO is out tonight, which includes some great performance upgrades and a new LCD library.

GPIO Speed

People tend to worry about the speed of GPIO operations when using sysfs entries. While it's in many ways arbitrary for timing sensitive applications because no GPIO access from userspace is real-time anyway, version 0.9.3 brings significantly faster GPIO operations. All of the GPIO related code is now in C extensions, and all GPIO state file descriptors used in a program are kept open until it exits.

Running this test program with v0.9.2:

from bbio import *
pinMode(GPIO1_28, OUTPUT)
while 1:
  digitalWrite(GPIO1_28, HIGH)
  digitalWrite(GPIO1_28, LOW)

The pin is toggled at about 1.5kHz. Running the same program with v0.9.3 now toggles the pin at about 25kHz, or around 17x faster.


There's also a new library for driving HD44780 compatible character LCDs. It supports the majority of the LCD's functionality (though not all of it is tested yet!), including scrolling and custom glyphs. API docs coming soon...


The rest of the major changes are:

  • Moved all GPIO code to C extension
  • Added LiquidCrystal character LCD library
  • Improved sysfs interface for faster kernel driver file access
  • Removed 3.2 support, use 0.9.2 if you're still running 3.2 for some reason...
  • Libraries are now contained within the bbio package. This changes importing a bit, user code will need updating
  • Simplifies
    • Examples are no longer copied
    • DT overlays are distributed compiled and copied with setuptool as data_files
  • BBIOServer now serves from ~/.BBIOServer instead of from inside the package
  • Started adding stubs for universion-io support, not yet implemented