Pamoja.Gpio 0.1.18

dotnet add package Pamoja.Gpio --version 0.1.18
                    
NuGet\Install-Package Pamoja.Gpio -Version 0.1.18
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pamoja.Gpio" Version="0.1.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pamoja.Gpio" Version="0.1.18" />
                    
Directory.Packages.props
<PackageReference Include="Pamoja.Gpio" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pamoja.Gpio --version 0.1.18
                    
#r "nuget: Pamoja.Gpio, 0.1.18"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pamoja.Gpio@0.1.18
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pamoja.Gpio&version=0.1.18
                    
Install as a Cake Addin
#tool nuget:?package=Pamoja.Gpio&version=0.1.18
                    
Install as a Cake Tool

Pamoja.Gpio

I2C address frames with reserved-range checks, the four SPI clock modes, and active-high or active-low pins. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.

read the guide documentation API reference

Install

dotnet add package Pamoja.Gpio
using Pamoja.Gpio;

This pulls in Pamoja.Native, the compiled engine. dotnet add package Pamoja is the whole framework in one package.

Example

The guide project's example, spliced here as it ran in CI.

From bindings/dotnet/samples/Pamoja.Guides/GpioGuide.cs:

// Most relay boards energize when their input is pulled low, and a float switch
// wired to ground closes the same way. Saying "active low" once, here, is what
// keeps the inversion out of every line below it.
const PinPolarity Relay = PinPolarity.ActiveLow;
const PinPolarity Float = PinPolarity.ActiveLow;
var pump = new Line();
var floatSwitch = new Line(PinLevel.High, PinLevel.Low);
Console.WriteLine(
    $"a pump on an active-low relay runs when its line is {Pin.LevelFor(Relay, true)}");

// The pump runs while the tank fills. The stand-in line answers open and then
// closed, so this is the real loop with nothing plugged in.
pump.Drive(Pin.LevelFor(Relay, true));
bool whileFilling = Pin.IsAsserted(Float, floatSwitch.Read());
bool onceFilled = Pin.IsAsserted(Float, floatSwitch.Read());
Console.WriteLine($"the float reads full: {whileFilling}, then {onceFilled}");

// The moment the float closes is that line going low, which is a falling edge. A
// watch armed for the rising one would sleep through the tank filling.
bool closing = Pin.Triggers(PinEdge.Falling, PinLevel.High, PinLevel.Low);
Console.WriteLine($"the float closing is a falling edge on that line: {closing}");

// Full, so the pump stops, and the levels the line was driven to are the whole
// conversation the board saw.
pump.Drive(Pin.LevelFor(Relay, false));
(PinLevel ran, PinLevel stopped) = (pump.Driven[0], pump.Driven[1]);
Console.WriteLine($"running drove the line {ran} and stopping drove it {stopped}");

// A part on a shared bus answers to an address, and the byte on the wire is not
// the address the datasheet prints: it shifts up one and the low bit says read or
// write.
byte toWrite = I2c.AddressFrame(0x76)[0];
byte toRead = I2c.AddressFrame(0x76, read: true)[0];
Console.WriteLine(
    $"a part at 0x76 is written to as 0x{toWrite:X2} and read from as 0x{toRead:X2}");

// Two ranges belong to the specification itself, so a part answering in either is
// a wiring mistake rather than a device.
bool reserved = I2c.IsReserved(I2c.ReservedFrom);
Console.WriteLine(
    $"0x{I2c.ReservedFrom:X2} is reserved by the specification: {reserved}");

// And a datasheet quotes SPI's clock polarity and phase as one mode number.
SpiClock clock = Spi.ClockFor(3);
Console.WriteLine(
    $"SPI mode 3 idles high: {clock.Cpol}, samples on the trailing edge: {clock.Cpha}");

The same capability in every language

Language Package Reference
Rust pamoja-gpio reference, docs.rs, install
TypeScript @pamoja/gpio reference, install
Python pamoja-gpio reference, install
C# Pamoja.Gpio reference, install

Documentation

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Pamoja.Gpio:

Package Downloads
Pamoja

The whole pamoja framework in one package: every capability of one memory-safe Rust core, behind an idiomatic C# facade, for IoT, robotics, and drones.

Pamoja.FieldIo

Field I/O: The wires a gateway actually has: framed serial packets, an RS485 request and the reply it draws, a CAN frame, the address a chip answers on, and the bus that carries a driver to the part.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.18 47 9/11/2026
0.1.17 119 9/6/2026
0.1.16 116 9/5/2026
0.1.15 113 9/5/2026