Skip to main content

Class Tca9548a

A TCA9548A i2c multiplexer

Assembly: Tca9548a.dll
View Source
public class Tca9548a : II2cCommunications, IByteCommunications

Implements:
Meadow.Hardware.II2cCommunications, Meadow.Hardware.IByteCommunications

Properties

Address

The address of this device on the Meadow.Foundation.ICs.IOExpanders.Tca9548a.Bus

View Source
public byte Address { get; }

Bus

The Meadow.Hardware.II2cBus this device is connected to.

View Source
public II2cBus Bus { get; }

Bus0

The Meadow.Hardware.II2cBus connected to SD0/SC0

View Source
public II2cBus Bus0 { get; }

Bus1

The Meadow.Hardware.II2cBus connected to SD1/SC1

View Source
public II2cBus Bus1 { get; }

Bus2

The Meadow.Hardware.II2cBus connected to SD2/SC2

View Source
public II2cBus Bus2 { get; }

Bus3

The Meadow.Hardware.II2cBus connected to SD3/SC3

View Source
public II2cBus Bus3 { get; }

Bus4

The Meadow.Hardware.II2cBus connected to SD4/SC4

View Source
public II2cBus Bus4 { get; }

Bus5

The Meadow.Hardware.II2cBus connected to SD5/SC5

View Source
public II2cBus Bus5 { get; }

Bus6

The Meadow.Hardware.II2cBus connected to SD6/SC6

View Source
public II2cBus Bus6 { get; }

Bus7

The Meadow.Hardware.II2cBus connected to SD7/SC7

View Source
public II2cBus Bus7 { get; }

Methods

Write(Span<byte>)

Write an array of bytes to the peripheral

View Source
public void Write(Span<byte> data)
Parameters
TypeNameDescription
System.Span<System.Byte>dataValues to be written

WriteRegister(byte, uint, ByteOrder)

Write an unsigned integer to the peripheral

View Source
public void WriteRegister(byte address, uint value, ByteOrder order = ByteOrder.LittleEndian)
Parameters
TypeNameDescription
System.ByteaddressAddress to write the first byte to
System.UInt32valueValue to be written
Meadow.ByteOrderorderIndicate if the data should be written as big or little endian

WriteRegister(byte, ulong, ByteOrder)

Write an unsigned long to the peripheral.

View Source
public void WriteRegister(byte address, ulong value, ByteOrder order = ByteOrder.LittleEndian)
Parameters
TypeNameDescription
System.ByteaddressAddress to write the first byte to
System.UInt64valueValue to be written
Meadow.ByteOrderorderIndicate if the data should be written as big or little endian

Write(byte)

Write a single byte to the peripheral.

View Source
public void Write(byte value)
Parameters
TypeNameDescription
System.BytevalueValue to be written (8-bits)

WriteRegister(byte, ushort, ByteOrder)

Write an unsigned short to the peripheral.

View Source
public void WriteRegister(byte address, ushort value, ByteOrder order = ByteOrder.LittleEndian)
Parameters
TypeNameDescription
System.ByteaddressAddress to write the first byte to
System.UInt16valueValue to be written (16-bits)
Meadow.ByteOrderorderIndicate if the data should be written as big or little endian

WriteRegister(byte, byte)

Write data to a register in the peripheral

View Source
public void WriteRegister(byte address, byte value)
Parameters
TypeNameDescription
System.ByteaddressAddress of the register to write to
System.BytevalueData to write into the register

ReadBytes(ushort)

Read bytes from the I2cBus

View Source
public byte[] ReadBytes(ushort numberOfBytes)
Returns

System.Byte[]

Parameters
TypeName
System.UInt16numberOfBytes

ReadRegister(byte)

Read a register from the peripheral

View Source
public byte ReadRegister(byte address)
Returns

System.Byte

Parameters
TypeNameDescription
System.ByteaddressAddress of the register to read.

ReadRegisterAsUShort(byte, ByteOrder)

Read an unsigned short from a register

View Source
public ushort ReadRegisterAsUShort(byte address, ByteOrder order)
Returns

System.UInt16

Parameters
TypeNameDescription
System.ByteaddressRegister address of the low byte (the high byte will follow).
Meadow.ByteOrderorderOrder of the bytes in the register (little endian is the default).

Read(Span<byte>)

Reads data from the peripheral

View Source
public void Read(Span<byte> readBuffer)
Parameters
TypeName
System.Span<System.Byte>readBuffer
Exceptions

System.NotImplementedException

ReadRegister(byte, Span<byte>)

Reads data from the peripheral starting at the specified address

View Source
public void ReadRegister(byte address, Span<byte> readBuffer)
Parameters
TypeName
System.Byteaddress
System.Span<System.Byte>readBuffer

WriteRegister(byte, Span<byte>, ByteOrder)

Write data to a register in the peripheral

View Source
public void WriteRegister(byte address, Span<byte> writeBuffer, ByteOrder order = ByteOrder.LittleEndian)
Parameters
TypeNameDescription
System.ByteaddressAddress of the register to write to
System.Span<System.Byte>writeBufferA buffer of byte values to be written
Meadow.ByteOrderorderIndicate if the data should be written as big or little endian

Exchange(Span<byte>, Span<byte>, DuplexType)

Write data to followed by read data from the peripheral.

View Source
public void Exchange(Span<byte> writeBuffer, Span<byte> readBuffer, DuplexType duplex)
Parameters
TypeNameDescription
System.Span<System.Byte>writeBufferData to write
System.Span<System.Byte>readBufferBuffer where read data will be written. Number of bytes read is determined by buffer size.
Meadow.Hardware.DuplexTypeduplexWhether the communication will happen in a half-duplex or full-duplex fashion.

Implements

  • Meadow.Hardware.II2cCommunications
  • Meadow.Hardware.IByteCommunications