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
Type | Name | Description |
---|---|---|
System.Span<System.Byte> | data | Values 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
Type | Name | Description |
---|---|---|
System.Byte | address | Address to write the first byte to |
System.UInt32 | value | Value to be written |
Meadow.ByteOrder | order | Indicate 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
Type | Name | Description |
---|---|---|
System.Byte | address | Address to write the first byte to |
System.UInt64 | value | Value to be written |
Meadow.ByteOrder | order | Indicate 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
Type | Name | Description |
---|---|---|
System.Byte | value | Value 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
Type | Name | Description |
---|---|---|
System.Byte | address | Address to write the first byte to |
System.UInt16 | value | Value to be written (16-bits) |
Meadow.ByteOrder | order | Indicate 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
Type | Name | Description |
---|---|---|
System.Byte | address | Address of the register to write to |
System.Byte | value | Data to write into the register |
ReadBytes(ushort)
Read bytes from the I2cBus
View Source
public byte[] ReadBytes(ushort numberOfBytes)
Returns
System.Byte[]
Parameters
Type | Name |
---|---|
System.UInt16 | numberOfBytes |
ReadRegister(byte)
Read a register from the peripheral
View Source
public byte ReadRegister(byte address)
Returns
System.Byte
Parameters
Type | Name | Description |
---|---|---|
System.Byte | address | Address 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
Type | Name | Description |
---|---|---|
System.Byte | address | Register address of the low byte (the high byte will follow). |
Meadow.ByteOrder | order | Order 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
Type | Name |
---|---|
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
Type | Name |
---|---|
System.Byte | address |
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
Type | Name | Description |
---|---|---|
System.Byte | address | Address of the register to write to |
System.Span<System.Byte> | writeBuffer | A buffer of byte values to be written |
Meadow.ByteOrder | order | Indicate 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
Type | Name | Description |
---|---|---|
System.Span<System.Byte> | writeBuffer | Data to write |
System.Span<System.Byte> | readBuffer | Buffer where read data will be written. Number of bytes read is determined by buffer size. |
Meadow.Hardware.DuplexType | duplex | Whether the communication will happen in a half-duplex or full-duplex fashion. |
Implements
Meadow.Hardware.II2cCommunications
Meadow.Hardware.IByteCommunications