Characteristic Locus
Namespace Meadow.Hardware
Assembly Meadow.dll

Syntax

public interface IByteCommunications

Methods

View Source

ReadBytes(UInt16)

Read the specified number of bytes from the peripheral.

Declaration
byte[] ReadBytes(ushort numberOfBytes)

Parameters

Type Name Description
System.UInt16 numberOfBytes

Number of bytes.

Returns

Type Description
System.Byte[]

The bytes.

View Source

ReadRegister(Byte)

Read a registers from the peripheral.

Declaration
byte ReadRegister(byte address)

Parameters

Type Name Description
System.Byte address

Address of the register to read.

Returns

Type Description
System.Byte
View Source

ReadRegisters(Byte, UInt16)

Read one or more registers from the peripheral.

Declaration
byte[] ReadRegisters(byte address, ushort length)

Parameters

Type Name Description
System.Byte address

Address of the first register to read.

System.UInt16 length

Number of bytes to read from the device.

Returns

Type Description
System.Byte[]
View Source

ReadUShort(Byte, ByteOrder)

Read an usingned short from a pair of registers.

Declaration
ushort ReadUShort(byte address, ByteOrder order)

Parameters

Type Name Description
System.Byte address

Register address of the low byte (the high byte will follow).

ByteOrder order

Order of the bytes in the register (little endian is the default).

Returns

Type Description
System.UInt16

Value read from the register.

View Source

ReadUShorts(Byte, UInt16, ByteOrder)

Read the specified number of unsigned shorts starting at the register address specified.

Declaration
ushort[] ReadUShorts(byte address, ushort number, ByteOrder order = ByteOrder.LittleEndian)

Parameters

Type Name Description
System.Byte address

First register address to read from.

System.UInt16 number

Number of unsigned shorts to read.

ByteOrder order

Order of the bytes (Little or Big endian)

Returns

Type Description
System.UInt16[]

Array of unsigned shorts.

View Source

WriteByte(Byte)

Write a single byte to the peripheral.

Declaration
void WriteByte(byte value)

Parameters

Type Name Description
System.Byte value

Value to be written (8-bits).

View Source

WriteBytes(Byte[])

Write an array of bytes to the peripheral.

Declaration
void WriteBytes(byte[] values)

Parameters

Type Name Description
System.Byte[] values

Values to be written.

View Source

WriteRead(Byte[], UInt16)

Write data to the peripheral and also read some data from the peripheral.

Declaration
byte[] WriteRead(byte[] write, ushort length)

Parameters

Type Name Description
System.Byte[] write

Array of bytes to be written to the device.

System.UInt16 length

Amount of data to read from the device.

Returns

Type Description
System.Byte[]

Remarks

The number of bytes to be written and read will be determined by the length of the byte arrays.

View Source

WriteRegister(Byte, Byte)

Write data a register in the peripheral.

Declaration
void WriteRegister(byte address, byte value)

Parameters

Type Name Description
System.Byte address

Address of the register to write to.

System.Byte value

Data to write into the register.

View Source

WriteRegisters(Byte, Byte[])

Write data to one or more registers.

Declaration
void WriteRegisters(byte address, byte[] data)

Parameters

Type Name Description
System.Byte address

Address of the first register to write to.

System.Byte[] data

Data to write into the registers.

View Source

WriteUShort(Byte, UInt16, ByteOrder)

Write an unsigned short to the peripheral.

Declaration
void WriteUShort(byte address, ushort value, ByteOrder order = ByteOrder.LittleEndian)

Parameters

Type Name Description
System.Byte address

Address to write the first byte to.

System.UInt16 value

Value to be written (16-bits).

ByteOrder order

Indicate if the data should be written as big or little endian.

View Source

WriteUShorts(Byte, UInt16[], ByteOrder)

Write a number of unsigned shorts to the peripheral.

Declaration
void WriteUShorts(byte address, ushort[] values, ByteOrder order = ByteOrder.LittleEndian)

Parameters

Type Name Description
System.Byte address

Address to write the first byte to.

System.UInt16[] values

Values to be written.

ByteOrder order

Indicate if the data should be written as big or little endian.

Remarks

The number of bytes to be written will be determined by the length of the byte array.