Table of Contents

Class I2cPart

Namespace
Pamoja.Hal
Assembly
Pamoja.Hal.dll

A part that is not there, answering from 256 registers a byte wide.

public sealed class I2cPart : SimulatedPart, IDisposable
Inheritance
I2cPart
Implements
Inherited Members

Remarks

A write names a register and fills it and the ones after it; a read takes them back from wherever the last write left off. What a driver writes stays written, so Register(byte) reads a part's configuration back once a driver is done with it.

Constructors

I2cPart(NativeHandle)

Wraps a part a native call made, such as a simulated sensor from another package.

public I2cPart(NativeHandle handle)

Parameters

handle NativeHandle

The part's handle, released with pamoja_i2c_part_free.

I2cPart(byte)

Creates a part answering at one address, with every register reading zero.

public I2cPart(byte address)

Parameters

address byte

The 7-bit address it answers to.

Methods

Holding(byte, ReadOnlySpan<byte>)

Puts bytes in the part from a register on, and returns the part.

public I2cPart Holding(byte first, ReadOnlySpan<byte> bytes)

Parameters

first byte

The register the bytes start at.

bytes ReadOnlySpan<byte>

What to put there. Past the last register it wraps to the first.

Returns

I2cPart

This part, so calls chain.

Load(byte, ReadOnlySpan<byte>)

Puts bytes in the part from a register on.

public void Load(byte first, ReadOnlySpan<byte> bytes)

Parameters

first byte

The register the bytes start at.

bytes ReadOnlySpan<byte>

What to put there. Past the last register it wraps to the first.

Read(byte, int)

Reads consecutive registers from one register on.

public byte[] Read(byte first, int length)

Parameters

first byte

The first register.

length int

How many registers.

Returns

byte[]

One byte per register.

Register(byte)

Reads what one register holds now.

public byte Register(byte register)

Parameters

register byte

Which register.

Returns

byte

Its value, which is what a driver wrote if it wrote one.