Class Cp2112
Represents a CP2112 USB IO Expander
Assembly: Cp2112.dll
View Source
public class Cp2112 : IDisposable, IDigitalInputOutputController, IDigitalInputController, IDigitalOutputController, II2cController, IPinController
Implements:
System.IDisposable, Meadow.Hardware.IDigitalInputOutputController, Meadow.Hardware.IDigitalInputController, Meadow.Hardware.IDigitalOutputController, Meadow.Hardware.II2cController, Meadow.Hardware.IPinController
Properties
Pins
The pins
View Source
public Cp2112.PinDefinitions Pins { get; }
Methods
CreateI2cBus(int)
View Source
public II2cBus CreateI2cBus(int busNumber = 0)
Returns
Meadow.Hardware.II2cBus
Parameters
| Type | Name | 
|---|---|
| System.Int32 | busNumber | 
CreateI2cBus(IPin[], I2cBusSpeed)
Creates an I2C bus instance for the requested pins and bus speed
View Source
public II2cBus CreateI2cBus(IPin[] pins, I2cBusSpeed busSpeed)
Returns
Meadow.Hardware.II2cBus: An instance of an I2cBus
Parameters
| Type | Name | Description | 
|---|---|---|
| Meadow.Hardware.IPin[] | pins | An array of two pins holding the I2C clock and data pins | 
| Meadow.Hardware.I2cBusSpeed | busSpeed | The bus speed | 
CreateI2cBus(IPin, IPin, I2cBusSpeed)
Creates an I2C bus instance for the requested pins and bus speed
View Source
public II2cBus CreateI2cBus(IPin clock, IPin data, I2cBusSpeed busSpeed)
Returns
Meadow.Hardware.II2cBus: An instance of an I2cBus
Parameters
| Type | Name | Description | 
|---|---|---|
| Meadow.Hardware.IPin | clock | The I2C clock pin | 
| Meadow.Hardware.IPin | data | The I2C data pin | 
| Meadow.Hardware.I2cBusSpeed | busSpeed | The bus speed | 
CreateI2cBus(int, I2cBusSpeed)
Creates an I2C bus instance for the default pins and the requested bus speed
View Source
public II2cBus CreateI2cBus(int busNumber, I2cBusSpeed busSpeed)
Returns
Meadow.Hardware.II2cBus: An instance of an I2cBus
Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | busNumber | The bus number | 
| Meadow.Hardware.I2cBusSpeed | busSpeed | The bus speed | 
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 ResistorModespecifying whether an | 
external pull-up/pull-down resistor is used, or an internal pull-up/pull-down
resistor should be configured for default state. |
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), orHIGH(true). | ||
| Meadow.Hardware.OutputType | initialOutputType | Whether the port is initially configured | 
| as PushPull or OpenDrain. PushPull by default. | 
Dispose(bool)
View Source
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | 
|---|---|
| System.Boolean | disposing | 
~Cp2112()
Finalizes native resources for the CP2112
View Source
protected ~Cp2112()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
View Source
public void Dispose()
Implements
- System.IDisposable
- Meadow.Hardware.IDigitalInputOutputController
- Meadow.Hardware.IDigitalInputController
- Meadow.Hardware.IDigitalOutputController
- Meadow.Hardware.II2cController
- Meadow.Hardware.IPinController