Skip to main content

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
TypeNameDescription
System.String[]reservedPinListList 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
TypeNameDescription
Meadow.Hardware.IPinpinThe Meadow.Hardware.IPin representing the discrete output pin.
System.BooleanvalueThe 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
TypeNameDescription
Meadow.Hardware.IPinpinThe 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
TypeNameDescription
Meadow.Hardware.IPinpinThe Meadow.Hardware.IPin to set the resistor mode for.
Meadow.Hardware.ResistorModemodeThe 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
TypeName
Meadow.Hardware.IPinpin
System.BooleaninitialState
Meadow.Hardware.OutputTypeoutputType

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
TypeName
Meadow.Hardware.IPinpin
Meadow.Hardware.ResistorModeresistorMode
Meadow.Hardware.InterruptModeinterruptMode
System.TimeSpandebounceDuration
System.TimeSpanglitchDuration

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
TypeName
Meadow.Hardware.IPinpin
Meadow.Hardware.InterruptModeinterruptMode
Meadow.Hardware.ResistorModeresistorMode
System.TimeSpandebounceDuration
System.TimeSpanglitchDuration

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
TypeNameDescription
Meadow.Hardware.IPinpinThe Meadow.Hardware.IPin to unconfigure.

ConfigureAnalogInput(IPin)

Configures a pin as an analog input.

View Source
void ConfigureAnalogInput(IPin pin)
Parameters
TypeName
Meadow.Hardware.IPinpin

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
TypeNameDescription
Meadow.Hardware.IPinpinThe 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
TypeNameDescription
Meadow.Hardware.IPinpinThe Meadow.Hardware.IPin to reassert the configuration for.
System.BooleanvalidateInterruptGroupWhether to validate the interrupt group for the pin.

GetTemperature()

Gets the temperature reading from the device.

View Source
Temperature GetTemperature()
Returns

Meadow.Units.Temperature: The current temperature reading as a Meadow.Units.Temperature object.## Events

Interrupt

Event triggered when an interrupt occurs on a pin.

View Source
event InterruptHandler Interrupt
Event Type

Meadow.Hardware.InterruptHandler