Class Pcx8574
Represent an Pcx8574 8 bit I2C port expander
Assembly: Pcx857x.dll
View Source
public abstract class Pcx8574 : Pcx857x, IDigitalOutputController, IDigitalInputController, IDigitalInterruptController, IPinController, II2cPeripheral, IDisposable
Inheritance: System.Object
-> Meadow.Foundation.ICs.IOExpanders.Pcx857x
Derived:
Meadow.Foundation.ICs.IOExpanders.Pca8574, Meadow.Foundation.ICs.IOExpanders.Pcf8574
Implements:
Meadow.Hardware.IDigitalOutputController
, Meadow.Hardware.IDigitalInputController
, Meadow.Hardware.IDigitalInterruptController
, Meadow.Hardware.IPinController
, Meadow.Hardware.II2cPeripheral
, System.IDisposable
Properties
Pins
Pcx8574 pin definitions
View Source
public Pcx8574.PinDefinitions Pins { get; }
NumberOfPins
The number of IO pins available on the device
View Source
public override int NumberOfPins { get; }
Methods
IsValidPin(IPin)
Is the pin valid for this device instance
View Source
protected override bool IsValidPin(IPin pin)
Returns
System.Boolean
: True if pin is valid
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The IPin to validate |
GetPin(string)
Get pin reference by name
View Source
public override IPin GetPin(string pinName)
Returns
Meadow.Hardware.IPin
: IPin reference if found
Parameters
Type | Name | Description |
---|---|---|
System.String | pinName | The pin name as a string |
SetPinDirection(bool, byte)
Set the pin direction
View Source
protected override void SetPinDirection(bool input, byte pinKey)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | input | true for input, false for output |
System.Byte | pinKey | The pin key value |
GetPinState(IPin)
Retrieves the state of a pin
View Source
protected override bool GetPinState(IPin pin)
Returns
System.Boolean
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin to query |
SetPinState(IPin, bool)
Sets the state of a pin
View Source
protected override void SetPinState(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 override ushort ReadState()
Returns
System.UInt16
WriteState(ushort)
Writes the peripheral state register
View Source
protected override void WriteState(ushort state)
Parameters
Type | Name |
---|---|
System.UInt16 | state |
SetState(ushort)
Writes the peripheral state register and updates driver internal state
View Source
protected override void SetState(ushort state)
Parameters
Type | Name |
---|---|
System.UInt16 | state |
ReadState8()
Reads the peripheral state register for 8 pin devices
View Source
protected byte ReadState8()
Returns
System.Byte
WriteState(byte)
Writes the peripheral state register for 8 pin devices
View Source
protected void WriteState(byte state)
Parameters
Type | Name |
---|---|
System.Byte | state |
Implements
Meadow.Hardware.IDigitalOutputController
Meadow.Hardware.IDigitalInputController
Meadow.Hardware.IDigitalInterruptController
Meadow.Hardware.IPinController
Meadow.Hardware.II2cPeripheral
System.IDisposable