nanoFramework.Iot.Device.Pca95x4
1.2.122
Prefix Reserved
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Pca95x4 --version 1.2.122
NuGet\Install-Package nanoFramework.Iot.Device.Pca95x4 -Version 1.2.122
<PackageReference Include="nanoFramework.Iot.Device.Pca95x4" Version="1.2.122" />
paket add nanoFramework.Iot.Device.Pca95x4 --version 1.2.122
#r "nuget: nanoFramework.Iot.Device.Pca95x4, 1.2.122"
// Install nanoFramework.Iot.Device.Pca95x4 as a Cake Addin #addin nuget:?package=nanoFramework.Iot.Device.Pca95x4&version=1.2.122 // Install nanoFramework.Iot.Device.Pca95x4 as a Cake Tool #tool nuget:?package=nanoFramework.Iot.Device.Pca95x4&version=1.2.122
Pca95x4 - I2C GPIO Expander
The PCA95x4 provides 8 bits of General Purpose parallel Input/Output (GPIO) expansion for I2C-bus applications.
Documentation
- Philips I2C IO expanders application notes can be found here
NXP
Texas Instruments
Board
Usage
Important: make sure you properly setup the I2C pins especially for ESP32 before creating the I2cDevice
, make sure you install the nanoFramework.Hardware.ESP32 nuget
:
//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the I2C GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);
For other devices like STM32, please make sure you're using the preset pins for the I2C bus you want to use.
This example shows how to write value out to 8 LEDs using a PCA95x4 device and a MCU.
I2cConnectionSettings i2cConnectionSettings = new(1, 0x38);
I2cDevice i2cDevice = I2cDevice.Create(i2cConnectionSettings);
pca95x4 = new Pca95x4(i2cDevice);
Cycle output bits
pca95x4.Write(Register.Configuration, 0x00); // Make all outputs.
pca95x4.Write(Register.OutputPort, 0xFF); // Set all outputs.
for (int bitNumber = 0; bitNumber < 8; bitNumber++)
{
pca95x4.WriteBit(Register.OutputPort, bitNumber, false); // Clear output.
Thread.Sleep(500);
pca95x4.WriteBit(Register.OutputPort, bitNumber, true); // Set output.
}
Read Input Port
pca95x4.Write(Register.Configuration, 0xFF); // Make all inputs.
byte data = pca95x4.Read(Register.InputPort);
Debug.WriteLine($"Input Port: 0x{data:X2}");
Check Input Register Polarity Inversion
pca95x4.Write(Register.Configuration, 0xFF); // Make all inputs.
byte data = pca95x4.Read(Register.InputPort);
Debug.WriteLine($"Input Register: 0x{data:X2}");
pca95x4.InvertInputRegisterPolarity(true);
data = pca95x4.Read(Register.InputPort);
Debug.WriteLine($"Input Register Polarity Inverted: 0x{data:X2}");
pca95x4.InvertInputRegisterPolarity(false);
data = pca95x4.Read(Register.InputPort);
Debug.WriteLine($"Input Register: 0x{data:X2}");
Binding Notes
PCA9534/PCA9554 and PCA9534A/PCA9554A are identical except for a few differences.
- The removal of the internal I/O pull-up resistor which greatly reduces power consumption when the I/Os are held LOW.
- Each has a fixed I2C address. This allows for up to 16 of these devices (8 of each) on the same I2C bus.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.12.0)
- nanoFramework.Runtime.Events (>= 1.11.1)
- nanoFramework.System.Device.Gpio (>= 1.1.22)
- nanoFramework.System.Device.I2c (>= 1.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.772 | 66 | 2/4/2025 |
1.2.755 | 69 | 1/31/2025 |
1.2.737 | 68 | 1/13/2025 |
1.2.696 | 92 | 12/16/2024 |
1.2.673 | 105 | 10/23/2024 |
1.2.631 | 118 | 8/28/2024 |
1.2.570 | 99 | 6/14/2024 |
1.2.560 | 123 | 5/29/2024 |
1.2.548 | 120 | 5/15/2024 |
1.2.436 | 239 | 11/10/2023 |
1.2.329 | 200 | 5/26/2023 |
1.2.316 | 190 | 5/16/2023 |
1.2.313 | 179 | 5/12/2023 |
1.2.297 | 178 | 5/3/2023 |
1.2.203 | 345 | 12/28/2022 |
1.2.141 | 446 | 10/25/2022 |
1.2.122 | 456 | 10/12/2022 |
1.2.114 | 425 | 10/8/2022 |
1.2.95 | 454 | 9/22/2022 |
1.2.87 | 516 | 9/15/2022 |
1.2.73 | 447 | 9/8/2022 |
1.1.113.2032 | 440 | 6/23/2022 |
1.1.58.10097 | 460 | 5/23/2022 |
1.1.1 | 479 | 4/14/2022 |
1.0.277-preview.125 | 127 | 3/25/2022 |
1.0.277-preview.98 | 124 | 3/8/2022 |
1.0.277-preview.41 | 132 | 1/28/2022 |
1.0.277-preview.32 | 139 | 1/27/2022 |
1.0.277-preview.17 | 136 | 1/24/2022 |
1.0.277-preview.15 | 127 | 1/21/2022 |
1.0.277-preview.1 | 129 | 1/11/2022 |
1.0.259 | 324 | 12/9/2021 |
1.0.218 | 202 | 10/18/2021 |
1.0.155 | 358 | 8/31/2021 |
1.0.136 | 415 | 7/17/2021 |
1.0.135 | 172 | 7/16/2021 |
1.0.134 | 186 | 7/15/2021 |
1.0.133 | 194 | 7/14/2021 |
1.0.130 | 196 | 7/6/2021 |
1.0.129 | 173 | 7/6/2021 |
1.0.125 | 210 | 7/5/2021 |
1.0.121 | 216 | 6/29/2021 |
1.0.119 | 231 | 6/28/2021 |
1.0.57 | 216 | 5/25/2021 |