Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/devices/Tca955x/Tca9554.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public class Tca9554 : Tca955x
/// <param name="interrupt">The input pin number that is connected to the interrupt.</param>
/// <param name="gpioController">The controller for the reset and interrupt pins. If not specified, the default controller will be used.</param>
/// <param name="shouldDispose">True to dispose the <paramref name="gpioController"/> when this object is disposed</param>
public Tca9554(I2cDevice device, int interrupt = -1, GpioController? gpioController = null, bool shouldDispose = true)
: base(device, interrupt, gpioController, shouldDispose)
/// <param name="skipAddressCheck">True to skip checking the I2C address is in the valid range for the device. Only set this to true if you are using a compatible device with a different addresss scheme.</param>
public Tca9554(I2cDevice device, int interrupt = -1, GpioController? gpioController = null, bool shouldDispose = true, bool skipAddressCheck = false)
: base(device, interrupt, gpioController, shouldDispose, skipAddressCheck)
{
}

Expand Down
5 changes: 3 additions & 2 deletions src/devices/Tca955x/Tca9555.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public class Tca9555 : Tca955x
/// <param name="interrupt">The input pin number that is connected to the interrupt.</param>
/// <param name="gpioController">The controller for the reset and interrupt pins. If not specified, the default controller will be used.</param>
/// <param name="shouldDispose">True to dispose the <paramref name="gpioController"/> when this object is disposed</param>
public Tca9555(I2cDevice device, int interrupt = -1, GpioController? gpioController = null, bool shouldDispose = true)
: base(device, interrupt, gpioController, shouldDispose)
/// <param name="skipAddressCheck">True to skip checking the I2C address is in the valid range for the device. Only set this to true if you are using a compatible device with a different addresss scheme.</param>
public Tca9555(I2cDevice device, int interrupt = -1, GpioController? gpioController = null, bool shouldDispose = true, bool skipAddressCheck = false)
: base(device, interrupt, gpioController, shouldDispose, skipAddressCheck)
{
}

Expand Down
8 changes: 5 additions & 3 deletions src/devices/Tca955x/Tca955x.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ public abstract class Tca955x : GpioDriver
/// <param name="interrupt">The input pin number that is connected to the interrupt.Must be set together with the <paramref name="gpioController"/></param>
/// <param name="gpioController">The controller for the interrupt pin. Must be set together with the <paramref name="interrupt"/></param>
/// <param name="shouldDispose">True to dispose the <paramref name="gpioController"/> when this object is disposed</param>
protected Tca955x(I2cDevice device, int interrupt = -1, GpioController? gpioController = null, bool shouldDispose = true)
/// <param name="skipAddressCheck">True to skip checking the I2C address is in the valid range for the device. Only set this to true if you are using a compatible device with a different addresss scheme.</param>
protected Tca955x(I2cDevice device, int interrupt = -1, GpioController? gpioController = null, bool shouldDispose = true, bool skipAddressCheck = false)
{
_busDevice = device;
_interrupt = interrupt;

if (_busDevice.ConnectionSettings.DeviceAddress < DefaultI2cAddress ||
_busDevice.ConnectionSettings.DeviceAddress > DefaultI2cAddress + AddressRange)
if (!skipAddressCheck &&
(_busDevice.ConnectionSettings.DeviceAddress < DefaultI2cAddress ||
_busDevice.ConnectionSettings.DeviceAddress > DefaultI2cAddress + AddressRange))
{
throw new ArgumentOutOfRangeException(nameof(device), $"Address should be in Range {DefaultI2cAddress} to {DefaultI2cAddress + AddressRange} inclusive");
}
Expand Down
Loading