GPIO_NXP_Arduino 1.0.1
GPIO device operation sample code for Arduino
|
GPIO device operation sample code for Arduino
Note
This library works with I2C_device
library together. Please be sure the I2C_device
library is imported in your environment before trying to build.
PCAL6416AEV-ARD (on Arduino), PCAL6534EV-ARD, PCAL6524EV-ARD and PCAL6408A-ARD (far side from left to right) : Arduino® Shield Evaluation Boards for GPIO
An Arduino library for I²C GPIO-expander with sample code.
This library provides simple API to control GPIO device IO bits Include device name header file (PCAL6408A.h
, PCAL6416A.h
, PCAL6424.h
, PCAL6434.h
, PCA9554.h
, and/or PCA9555.h
) to use those class libraries.
With GPIO_NXP_Arduino
library, parallel output can be controlled by next sample code.
Type# | Header file | IO bits | Features | Interface | Evaluation board |
---|---|---|---|---|---|
PCAL6408A | PCAL6408A.h | 8 | Low-Voltage Translating, 8-Bit I²C-Bus/SMBus I/O Expander | I²C Fast-mode Plus (1MHz) | PCAL6408A 8-Bit GPIO Arduino® Shield |
PCAL6416A | PCAL6416A.h | 16 | Low-Voltage Translating 16-Bit I²C-Bus/SMBus I/O Expander | I²C Fast-mode Plus (1MHz) | PCAL6416A 16-bit GPIO Arduino® Shield |
PCAL6424 | PCAL6424.h | 24 | Ultra-Low-Voltage Translating 24-Bit Fm+ I²C-Bus/SMBus I/O Expander | I²C Fast-mode Plus (1MHz) | PCAL6524EV 24-Bit GPIO Arduino® Shield |
PCAL6434 | PCAL6434.h | 34 | Ultra-Low-Voltage, Level Translating, 34-Bit I2C-Bus/SMBus I/O Expander | I²C Fast-mode Plus (1MHz) | PCAL6534EV 34-Bit GPIO Arduino® Shield |
PCA9554 not tested | PCA9554.h | 8 | 8-Bit I²C-Bus and SMBus I/O Port with Interrupt | I²C Fast-mode (400Hz) | — |
PCA9555 | PCA9555.h | 16 | 16-Bit I²C-Bus and SMBus I/O Port with Interrupt | I²C Fast-mode (400Hz) | — |
Use Library manager in Arduino IDE for easy install
Examples are provided as scketch files.
After library install, Choose menu on Arduino-IDE: File
→Examples
→GPIO_NXP_Arduino
→ sketch for your try
Sketch | Folder/Target | Feature |
---|---|---|
PCAL6408A_simple_OUT | PCAL6408A | Simple sample for just output counter value |
PCAL6408A_simple_IN_OUT | PCAL6408A | Blink LED to show which buton pressed. Read value shown on serial terminal also |
PCAL6408A_interrupt | PCAL6408A | IO demo with interrupt |
PCAL6416A_simple_OUT | PCAL6416A | Simple sample for just output counter value |
PCAL6416A_simple_IN_OUT | PCAL6416A | Blink LED to show which buton pressed. Read value shown on serial terminal also |
PCAL6416A_interrupt | PCAL6416A | IO demo with interrupt |
PCAL6524A_simple_OUT | PCAL6524 | Simple sample for just output counter value |
PCAL6524_simple_IN_OUT | PCAL6524 | Blink LED to show which buton pressed. Read value shown on serial terminal also |
PCAL6524_interrupt | PCAL6524 | IO demo with interrupt |
PCAL6534_simple_OUT | PCAL6534 | Simple sample for just output counter value |
PCAL6534_simple_IN_OUT | PCAL6534 | Blink LED to show which buton pressed. Read value shown on serial terminal also |
PCAL6534_interrupt | PCAL6534 | IO demo with interrupt |
Sketch | Folder/Target | Feature |
---|---|---|
PCA9555_port0_OUT | PCA9555 | Simple sample for just output counter value |
PCA9555_port0_OUT_and_port1_IN | PCA9555 | To check output and input |
PCA9555_interrupt_on_port1 | PCA9555 | Interrupt check |
If you need to use different I²C bus on Arduino, it can be done like this. This sample shows how the Wire1
on Arduino Due can be operated.
For details of the library, please find descriptions in this document.
Library | Feature | Target devices | Required library |
---|---|---|---|
GPIO_NXP_Arduino | GPIO libraries | PCAL6408A, PCAL6416A, PCAL6524, PCAL6534, PCA9555, PCA9554 | I2C_device_Arduino |
LCDDriver_NXP_Arduino | LCD driver libraries | PCA8561 | I2C_device_Arduino |
LEDDriver_NXP_Arduino | LED driver libraries | PCA9955B, PCA9956B, PCA9957 | I2C_device_Arduino |
MUX_SW_NXP_Arduino | I²C mux/switch libraries | PCA9846 | I2C_device_Arduino |
RTC_NXP_Arduino | RTC libraries | PCF2131, PCF85063A | I2C_device_Arduino |
TempSensor_NXP_Arduino | Temperature sensor libraries | LM75B, PCT2075, P3T1085 | I2C_device_Arduino |
I2C_device_Arduino | Base library for I²C operations | none (can be applied as base class for all I²C targets) | — |