Timed blink - IO Abstraction library example
Timed blink is a version of well known Arduino blink example that is shipped with the standard IDE, but is redesigned to use the Abstraction and timer library. Example circuit for the code is exactly the same a blink, and if you use the inbuilt LED pin (which it does by default) then there’s no need to build any circuit whatsoever. Instead of using delay() calls to set the duration of the led flash, it uses the task management library to schedule a task.
SPI and I2C/Wire abstraction that works on Arduino, mbed, PicoSDK
IoAbstraction has core I2C/Wire and SPI functionality provided by several functions, these abstract the use of I2C and SPI over Arduino, mbed, PicoSDK and other supported platforms. Over time the implementation of these will be improved, such that asynchronous behaviour will be possible on certain boards. Prior to 2.0, we had conditional I2C code scattered around the project, but now nearly all such functionality is separated out by platform, and sometimes even by board simplifying access.
Simple Collection - btree list
IoAbstraction contains a very simple collection that is relatively lightweight and works on a wide range of boards. It is a btree list that provides ordering and list storage. It works on anything from Arduino Uno upwards! It’s memory usage is very configurable, and the way it resizes arrays is also configurable too. You can set the initial size if you know how many items to expect, and do not wish for it to resize, or you can rely on platform defaults, for more general purpose cases.
Simple Collection - Thread safe circular buffer
Circular buffer provides an easy way to interact with events that take place on another thread or in an interrupt, it is not very efficient when used on a single thread because it uses atomic operations to ensure consistency of the buffer. It is an advanced collection for use by users that understand threading and writing interrupt safe code. There are two implementations, an optmized version for storing bytes, and a generic version that can be used to store any type, the generic version can also be created as a memory pool, where it works slightly differently.
Task Manager Low Power example for SAMD boards
There are often cases when you’ll need to run a micro controller from a battery power source. Unlike when running from mains power, every milli-amp matters. In these cases IoAbstraction’s task manager is able to integrate easily with most low power libraries. Task manager works by repeatedly calling the runLoop() function within loop() or main, during each loop task manager evaluates if any tasks are yet ready to run, and if they are it runs them.
Rotary encoder with non-polling (interrupt based) switches from PCF8574
IoAbstraction has full support for interrupts on most devices, meaning we can connect a Rotary Encoder to an Arduino using a standard PCF8574 IO expander chip. In order to do this we need the PCF8574 /INT line to be connected to an Arduino pin that supports interrupts (such as pins 2 or 3). Further, you can also have switches handle push button input without polling, by initialising for interrupt, especially useful with IO exapnders.
AW9523 I2C IoExpander with LED controller - Arduino and mbed
IO Abstraction library fully supports the AW9523 16-bit IO expander chips on Arduino and mbed. It requires only two pins (three for interrupt mode) SDA, SCL, and optionally INT. Our driver integrates the GPIO, LED controller, and interrupt support providing nearly all functions using familiar Arduino terminology. This device can even be used in conjunction with an AW9523 analog device to make it even easier to use the LED controller.
MCP23017 I2C IoExpander for Arduino and mbed
IO Abstraction library fully supports the MCP23017 16-bit IO expander chips on Arduino and mbed. It requires only two pins (three for interrupt mode) SDA, SCL, and optionally INT. Our driver provides nearly all functionality using similar terminology to Arduino itself. The MCP23017 provides 16 additional input or output ports, they have very similar capabilities to device pins and interrupt support is managed per pin. This device can be used for switches, rotary encoders, and with LiquidCrystalIO.
MPR121 I2C Touch/IoExpander/LED controller - Arduino and mbed
IO Abstraction library fully supports the MPR121 12-bit Touch control and IO expander chips on Arduino and mbed. It requires only two pins (three for interrupt mode) SDA, SCL, and optionally INT. Our driver integrates the Touch, GPIO, LED controller, and interrupt support providing nearly all functions using familiar Arduino terminology. This device can even be used in conjunction with an MPR121 analog device to make it even easier to use the LED controller.
PCF8574 / PCF8575 I2C IoExpander for Arduino and mbed
IO Abstraction library fully supports the PCF8574 8-bit and PCF8575 16-bit IO expander chips on Arduino and mbed. It requires only two pins (three for interrupt mode) SDA, SCL, and optionally INT. Our driver integrates the interrupt support for you so you can attach interrupts very easily. The PCF8574 provides 8 additional input or output ports, but there are few limitations around how the device can be used, and these are discussed below.