Show / Hide Table of Contents
View Source

Class Gpio

Gpio is the General Purpose IO interface to libmraa. Its features depend on the board type used, it can use gpiolibs (exported via a kernel module through sysfs), or memory mapped IO via a /dev/uio device or /dev/mem depending again on the board configuration.

Inheritance
System.Object
Gpio
Namespace:MraaSharp
Assembly:MraaSharp.dll
Syntax
public class Gpio : IDisposable

Constructors

View Source

Gpio(Int32, MraaGpioDir, MraaGpioMode, Boolean)

Declaration
public Gpio(int pin, MraaGpioDir dir, MraaGpioMode mode, bool raw = false)
Parameters
Type Name Description
System.Int32 pin
MraaGpioDir dir
MraaGpioMode mode
System.Boolean raw
View Source

Gpio(Int32, MraaGpioDir, Boolean)

Declaration
public Gpio(int pin, MraaGpioDir dir, bool raw = false)
Parameters
Type Name Description
System.Int32 pin
MraaGpioDir dir
System.Boolean raw
View Source

Gpio(Int32, Boolean)

Initialise gpio context.

Declaration
public Gpio(int pin, bool raw = false)
Parameters
Type Name Description
System.Int32 pin

Pin number read from the board, i.e IO3 is 3. if raw parameter is true, gpio pin as listed in SYSFS.

System.Boolean raw

without any mapping to a pin if true.

Properties

View Source

Direction

Gpio direction

Declaration
public MraaGpioDir Direction
{
    get;
    set;
}
Property Value
Type Description
MraaGpioDir
View Source

EdgeMode

the edge mode on the gpio

Declaration
public MraaGpioEdge EdgeMode
{
    set;
}
Property Value
Type Description
MraaGpioEdge
View Source

Mode

Gpio Output Mode

Declaration
public MraaGpioMode Mode
{
    set;
}
Property Value
Type Description
MraaGpioMode
View Source

Owner

Change ownership of the context.

Declaration
public bool Owner
{
    set;
}
Property Value
Type Description
System.Boolean
View Source

Pin

Get a pin number of the gpio, invalid will return -1

Declaration
public int Pin
{
    get;
}
Property Value
Type Description
System.Int32
View Source

PinRaw

Get a gpio number as used within sysfs, invalid will return -1

Declaration
public int PinRaw
{
    get;
}
Property Value
Type Description
System.Int32
View Source

UseMmaped

Enable using memory mapped io instead of sysfs

Declaration
public bool UseMmaped
{
    set;
}
Property Value
Type Description
System.Boolean

Methods

View Source

Dispose()

Declaration
public void Dispose()
View Source

Read()

Read the Gpio value. This can be 0 or 1. A resonse of -1 means that there was a fatal error.

Declaration
public MraaGpioValue Read()
Returns
Type Description
MraaGpioValue

Result of operation

View Source

Write(MraaGpioValue)

Write to the Gpio Value.

Declaration
public void Write(MraaGpioValue value)
Parameters
Type Name Description
MraaGpioValue value

value to write

Back to top Copyright © 2015-2016 Microsoft
Generated by DocFX