Skip to main content

Class Pca9671

Represents a PCA9671 I2C IO Expander

Assembly: Pca9671.dll
View Source
public class Pca9671 : I2cCommunications, II2cCommunications, IByteCommunications, IDigitalOutputController, IDigitalInputController, IPinController, II2cPeripheral, IDisposable

Inheritance: System.Object -> Meadow.Foundation.I2cCommunications

Implements:
Meadow.Hardware.II2cCommunications, Meadow.Hardware.IByteCommunications, Meadow.Hardware.IDigitalOutputController, Meadow.Hardware.IDigitalInputController, Meadow.Hardware.IPinController, Meadow.Hardware.II2cPeripheral, System.IDisposable

Properties

IsDisposed

Is the object disposed

View Source
public bool IsDisposed { get; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
public byte DefaultI2cAddress { get; }

Pins

View Source
public Pca9671.PinDefinitions Pins { get; }

Methods

CreateDigitalOutputPort(IPin, bool, OutputType)

Creates an IDigitalOutputPort on the specified pin.

View Source
public IDigitalOutputPort CreateDigitalOutputPort(IPin pin, bool initialState = false, OutputType initialOutputType = OutputType.PushPull)
Returns

Meadow.Hardware.IDigitalOutputPort

Parameters
TypeNameDescription
Meadow.Hardware.IPinpinThe pin on which to create the port.
System.BooleaninitialStateThe default initial state of the port,
either LOW (false), or HIGH (true).
Meadow.Hardware.OutputTypeinitialOutputTypeWhether the port is initially configured
as PushPull or OpenDrain. PushPull by default.

CreateDigitalInputPort(IPin, ResistorMode)

Creates an IDigitalInputPort on the specified pin.

View Source
public IDigitalInputPort CreateDigitalInputPort(IPin pin, ResistorMode resistorMode)
Returns

Meadow.Hardware.IDigitalInputPort

Parameters
TypeNameDescription
Meadow.Hardware.IPinpinThe pin on which to create the port.
Meadow.Hardware.ResistorModeresistorModeThe ResistorMode specifying whether an
        external pull-up/pull-down resistor is used, or an internal pull-up/pull-down
        resistor should be configured for default state. |

GetPin(string)

View Source
public IPin GetPin(string pinName)
Returns

Meadow.Hardware.IPin

Parameters
TypeName
System.StringpinName

IsValidPin(IPin)

View Source
protected bool IsValidPin(IPin pin)
Returns

System.Boolean

Parameters
TypeName
Meadow.Hardware.IPinpin

Reset()

Resets the peripheral

View Source
public void Reset()

AllOff()

Convenience method to turn all outputs off

View Source
public void AllOff()

AllOn()

Convenience method to turn all outputs on

View Source
public void AllOn()

GetState(IPin)

Retrieves the state of a pin

View Source
public bool GetState(IPin pin)
Returns

System.Boolean

Parameters
TypeNameDescription
Meadow.Hardware.IPinpinThe pin to query

SetState(IPin, bool)

Sets the state of a pin

View Source
public void SetState(IPin pin, bool state)
Parameters
TypeNameDescription
Meadow.Hardware.IPinpinThe pin to affect
System.Booleanstate<b>True</b> to set the pin state high, <b>False</b> to set it low

ReadState()

Reads the peripheral state register

View Source
protected ushort ReadState()
Returns

System.UInt16

WriteState(ushort)

Writes the peripheral state register

View Source
protected void WriteState(ushort state)
Parameters
TypeName
System.UInt16state

Dispose(bool)

Dispose of the object

View Source
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
public void Dispose()

Implements

  • Meadow.Hardware.II2cCommunications
  • Meadow.Hardware.IByteCommunications
  • Meadow.Hardware.IDigitalOutputController
  • Meadow.Hardware.IDigitalInputController
  • Meadow.Hardware.IPinController
  • Meadow.Hardware.II2cPeripheral
  • System.IDisposable