Table of Contents

Class WordPart

Namespace
Pamoja.Hal
Assembly
Pamoja.Hal.dll

A part that is not there, answering from 256 registers sixteen bits wide.

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

Remarks

A pointer byte names a register and a register travels most significant byte first. A write of the pointer alone aims the next read; a write of the pointer and a word stores the word; a read takes words from the pointer on. Bits the part sets for itself, such as a conversion-ready flag, are marked with ReadOnly(byte, ushort) and keep the part's value whatever a driver writes.

Constructors

WordPart(NativeHandle)

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

public WordPart(NativeHandle handle)

Parameters

handle NativeHandle

The part's handle, released with pamoja_i2c_part_free.

WordPart(byte)

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

public WordPart(byte address)

Parameters

address byte

The 7-bit address it answers to.

Methods

Holding(byte, ushort)

Puts a value in one register and returns the part.

public WordPart Holding(byte register, ushort value)

Parameters

register byte

The register.

value ushort

What it holds, read-only bits included.

Returns

WordPart

This part, so calls chain.

ReadOnly(byte, ushort)

Marks bits of one register as the part's to set, and returns the part.

public WordPart ReadOnly(byte register, ushort mask)

Parameters

register byte

The register.

mask ushort

The bits a driver's write leaves as the part holds them.

Returns

WordPart

This part, so calls chain.

Set(byte, ushort)

Puts a value in one register, read-only bits included, the way the part itself would.

public void Set(byte register, ushort value)

Parameters

register byte

The register.

value ushort

What it holds.

Word(byte)

Reads what one register holds now.

public ushort Word(byte register)

Parameters

register byte

Which register.

Returns

ushort

Its value, which is what a driver wrote there apart from the read-only bits.