Interface IMeadowIOController
Defines the GPIO Manager for interacting with digital and analog pins.
Assembly: Meadow.Contracts.dll
View Source
public interface IMeadowIOController
Properties
DeviceChannelManager
Gets the device channel manager for managing input and output channels.
View Source
IDeviceChannelManager DeviceChannelManager { get; }
Methods
Initialize(string[]?)
Initializes the device pins to their default power-up status (outputs, low, and pulled down where applicable).
View Source
void Initialize(string[]? reservedPinList)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | reservedPinList | List of any pins to reserve. |
SetDiscrete(IPin, bool)
Sets the value of a discrete (digital) output pin.
View Source
void SetDiscrete(IPin pin, bool value)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin representing the discrete output pin. | ||
System.Boolean | value | The value to set on the discrete output pin (true for high, false for low). |
GetDiscrete(IPin)
Gets the value of a discrete (digital) input pin.
View Source
bool GetDiscrete(IPin pin)
Returns
System.Boolean
: The value of the discrete input pin (true for high, false for low).
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin representing the discrete input pin. |
SetResistorMode(IPin, ResistorMode)
Sets the resistor mode for the given pin.
View Source
void SetResistorMode(IPin pin, ResistorMode mode)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin to set the resistor mode for. | ||
Meadow.Hardware.ResistorMode | mode | The resistor mode to set. |
ConfigureOutput(IPin, bool, OutputType)
Configures a pin as an output with specified initial state and output type.
View Source
void ConfigureOutput(IPin pin, bool initialState, OutputType outputType)
Parameters
Type | Name |
---|---|
Meadow.Hardware.IPin | pin |
System.Boolean | initialState |
Meadow.Hardware.OutputType | outputType |
ConfigureInput(IPin, ResistorMode, InterruptMode, TimeSpan, TimeSpan)
Configures a pin as an input with specified resistor mode, interrupt mode, debounce duration, and glitch duration.
View Source
void ConfigureInput(IPin pin, ResistorMode resistorMode, InterruptMode interruptMode, TimeSpan debounceDuration, TimeSpan glitchDuration)
Parameters
Type | Name |
---|---|
Meadow.Hardware.IPin | pin |
Meadow.Hardware.ResistorMode | resistorMode |
Meadow.Hardware.InterruptMode | interruptMode |
System.TimeSpan | debounceDuration |
System.TimeSpan | glitchDuration |
WireInterrupt(IPin, InterruptMode, ResistorMode, TimeSpan, TimeSpan)
Wires an interrupt for the specified pin with the given interrupt mode, resistor mode, debounce duration, and glitch duration.
View Source
void WireInterrupt(IPin pin, InterruptMode interruptMode, ResistorMode resistorMode, TimeSpan debounceDuration, TimeSpan glitchDuration)
Parameters
Type | Name |
---|---|
Meadow.Hardware.IPin | pin |
Meadow.Hardware.InterruptMode | interruptMode |
Meadow.Hardware.ResistorMode | resistorMode |
System.TimeSpan | debounceDuration |
System.TimeSpan | glitchDuration |
UnconfigureGpio(IPin)
Unconfigures a previously configured GPIO pin.
View Source
bool UnconfigureGpio(IPin pin)
Returns
System.Boolean
: true
if the pin was successfully unconfigured, false
otherwise.
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin to unconfigure. |
ConfigureAnalogInput(IPin)
Configures a pin as an analog input.
View Source
void ConfigureAnalogInput(IPin pin)
Parameters
Type | Name |
---|---|
Meadow.Hardware.IPin | pin |
GetAnalogValue(IPin)
Gets the analog value read from the specified pin.
View Source
int GetAnalogValue(IPin pin)
Returns
System.Int32
: The analog value read from the pin.
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin representing the analog input pin. |
ReassertConfig(IPin, bool)
Reasserts the configuration for the specified pin.
View Source
void ReassertConfig(IPin pin, bool validateInterruptGroup = true)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin to reassert the configuration for. | ||
System.Boolean | validateInterruptGroup | Whether to validate the interrupt group for the pin. |
GetTemperature()
Gets the temperature reading from the device.
View Source
Temperature GetTemperature()
Returns
Meadow.Units.Temperature object.## Events
Interrupt
Event triggered when an interrupt occurs on a pin.
View Source
event InterruptHandler Interrupt