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
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin on which to create the port. |
System.Boolean | initialState | The default initial state of the port, |
either LOW (false ), or HIGH (true ). | ||
Meadow.Hardware.OutputType | initialOutputType | Whether 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
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin on which to create the port. |
Meadow.Hardware.ResistorMode | resistorMode | The 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
Type | Name |
---|---|
System.String | pinName |
IsValidPin(IPin)
View Source
protected bool IsValidPin(IPin pin)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
Meadow.Hardware.IPin | pin |
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
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin to query |
SetState(IPin, bool)
Sets the state of a pin
View Source
public void SetState(IPin pin, bool state)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin to affect |
System.Boolean | state | <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
Type | Name |
---|---|
System.UInt16 | state |
Dispose(bool)
Dispose of the object
View Source
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Is 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