Creates a variable of type IOstrich, to communicate with the shield.
IOstrich(address)
address - Address on the I2C bus of the shield to communicate with
Instance of IOstrich associated with a specific shield.
#include <Wire.h>
#include <IOstrich.h>
// Create an IOstrich instance to communicate with the shield at address 0x20
IOstrich iosInstance = IOstrich(0x20);
Configure the specified GPIO pin to be an input or an output.
IOstrichInstance.pinMode(bank, pin, direction);
bank - Bank containing GPIO pin to change pin - GPIO pin number to change direction - either INPUT or OUTPUT
nothing
#include <Wire.h>
#include <IOstrich.h>
// Create an IOstrich instance to communicate with the shield at 0x20
IOstrich iosInstance = IOstrich(0x20);
void setup() {
// Configure bank A GPIO pin 0 as an output, 1 as an input
iosInstance.pinMode(BANK_A, 0, OUTPUT);
iosInstance.pinMode(BANK_A, 1, INPUT);
}
Configure the specified GPIO pin to be inverted or not. Inverted mode means that setting the pin to HIGH outputs 0v, and vice-versa.
IOstrichInstance.pinInvert(bank, pin, inverted);
bank - Bank containing GPIO pin to change pin - GPIO pin number to change inverted - NORMAL or INVERTED
nothing
#include <Wire.h>
#include <IOstrich.h>
// Create an IOstrich instance to communicate with the shield at 0x20
IOstrich iosInstance = IOstrich(0x20);
void setup() {
// Configure bank A GPIO pin 0 to be inverted (digitalWrite to 1 makes it output low)
iosInstance.pinMode(BANK_A, 0, INVERTED);
// Configure bank A GPIO pin 0 to be non-inverted (which is the default)
iosInstance.pinMode(BANK_A, 1, NORMAL);
}
Configure the specified GPIO pin to generate interrupts on change or not.
IOstrichInstance.pinInterrupt(bank, pin, interrupt);
bank - Bank containing GPIO pin to change pin - GPIO pin number to change interrupt - 0 (do not generate interrupts on change) or 1 (generate interrupts on change)
nothing
#include <Wire.h>
#include <IOstrich.h>
// Create an IOstrich instance to communicate with the shield at 0x20
IOstrich iosInstance = IOstrich(0x20);
void setup() {
// Configure bank A GPIO pin 0 to generate interrupts on change
iosInstance.pinInterrupt(BANK_A, 0, 1);
}
Configure the specified bank to generate interrupts on change or not.
IOstrichInstance.bankInterrupt(bank, interrupt);
bank - Bank containing GPIO pins to change interrupt - Byte containing 0 (do not generate interrupts on change) or 1 (generate interrupts on change) for each bit, each representing one pin.
nothing
#include <Wire.h>
#include <IOstrich.h>
// Create an IOstrich instance to communicate with the shield at 0x20
IOstrich iosInstance = IOstrich(0x20);
void setup() {
// Configure bank A GPIO pin 0 and 2 to generate interrupts on change
iosInstance.bankInterrupt(BANK_A, 0x05); // 00000101
}
Set a specified GPIO pin to a HIGH or LOW state. Unlike the Arduino digital pins, these do not have pullup resistors, so digitalWrite when the pin is set to an input has no effect.
IOstrichInstance.digitalWrite(bank, pin, value)
bank - Bank containing GPIO pin to change pin - GPIO pin number to change value - HIGH or LOW
nothing
#include <Wire.h>
#include <IOstrich.h>
// Create an IOstrich instance to communicate with the shield at 0x20
IOstrich iosInstance = IOstrich(0x20);
void setup() {
// Configure bank A GPIO pin 0 as an output
iosInstance.pinMode(BANK_A, 0, OUTPUT);
// Set bank A GPIO pin 0 to a HIGH level
iosInstance.digitalWrite(BANK_A, 0, HIGH);
}
Read the current value of a specific GPIO pin.
IOstrichInstance.digitalRead(bank, pin)
bank - Bank containing GPIO pin to read pin - GPIO pin number to read the value of
HIGH or LOW
#include <Wire.h>
#include <IOstrich.h>
// Create an IOstrich instance to communicate with the shield at 0x20
IOstrich iosInstance = IOstrich(0x20);
void setup() {
byte pinLevel;
// Configure bank A GPIO pin 0 as an input
iosInstance.pinMode(BANK_A, 0, INPUT);
// Read the value on bank A GPIO pin 0 and put it into pinLevel
pinLevel = iosInstance.digitalRead(BANK_A, 0);
}