C# Class CyrusBuilt.MonoPi.IO.GpioFile

Raspberry Pi GPIO using the file-based access method.
Inheritance: GpioBase
ファイルを表示 Open project: cyrusbuilt/MonoPi Class Usage Examples

Public Methods

Method Description
Cleanup ( ) : void

Unexports all pins in the registry.

Dispose ( ) : void

Releases all resource used by the CyrusBuilt.MonoPi.IO.GpioFile object.

Call Dispose when you are finished using the CyrusBuilt.MonoPi.IO.GpioFile. The Dispose method leaves the CyrusBuilt.MonoPi.IO.GpioFile in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.IO.GpioFile so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.IO.GpioFile was occupying.

GpioFile ( GpioPins pin ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioFile class with the Rev1 pin to access.

GpioFile ( GpioPins pin, PinMode mode ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioFile class with the Rev1 pin to access and the I/O direction.

GpioFile ( GpioPins pin, PinMode mode, PinState initialValue ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioFile class with the Rev1 pin to access, the I/O direction, and the initial value.

Provision ( ) : void

Provisions the pin (initialize to specified mode and make active).

Pulse ( ) : void

Pulse the pin output for 500ms.

Pulse ( Int32 millis ) : void

Pulse the pin output for the specified number of milliseconds.

Read ( ) : PinState

Read a value from the pin.

Read ( GpioPins pin ) : PinState

Read a value from the specified pin.

Write ( GpioPins pin, PinState value ) : void

Writes the specified value to the specified GPIO pin.

Write ( PinState value ) : void

Write the specified value to the pin.

Private Methods

Method Description
ExportPin ( GpioPins pin, PinMode mode ) : void

Exports the GPIO setting the direction. This creates the /sys/class/gpio/gpioXX directory.

UnexportPin ( GpioPins pin ) : void

Unexport the GPIO. This removes the /sys/class/gpio/gpioXX directory.

internal_ExportPin ( Int32 pin, PinMode mode, String pinnum, String pinname ) : void

Exports the GPIO setting the direction. This creates the /sys/class/gpio/gpioXX directory.

internal_Read ( Int32 pin, String gpionum, String gpioname ) : PinState

Reads the value of the specified GPIO pin.

internal_UnexportPin ( Int32 pin, String gpioNum ) : void

Unexport the GPIO. This removes the /sys/class/gpio/gpioXX directory.

internal_Write ( Int32 pin, PinState value, String gpionum, String pinname ) : void

Writes the specified value to the specified GPIO pin.

Method Details

Cleanup() public static method

Unexports all pins in the registry.
public static Cleanup ( ) : void
return void

Dispose() public method

Releases all resource used by the CyrusBuilt.MonoPi.IO.GpioFile object.
Call Dispose when you are finished using the CyrusBuilt.MonoPi.IO.GpioFile. The Dispose method leaves the CyrusBuilt.MonoPi.IO.GpioFile in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.IO.GpioFile so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.IO.GpioFile was occupying.
public Dispose ( ) : void
return void

GpioFile() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioFile class with the Rev1 pin to access.
public GpioFile ( GpioPins pin ) : System
pin GpioPins /// The pin on the board to access. ///
return System

GpioFile() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioFile class with the Rev1 pin to access and the I/O direction.
public GpioFile ( GpioPins pin, PinMode mode ) : System
pin GpioPins /// The pin on the board to access. ///
mode PinMode /// The I/0 mode of the pin. ///
return System

GpioFile() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioFile class with the Rev1 pin to access, the I/O direction, and the initial value.
public GpioFile ( GpioPins pin, PinMode mode, PinState initialValue ) : System
pin GpioPins /// The pin on the board to access. ///
mode PinMode /// The I/0 mode of the pin. ///
initialValue PinState /// The pin's initial value. ///
return System

Provision() public method

Provisions the pin (initialize to specified mode and make active).
public Provision ( ) : void
return void

Pulse() public method

Pulse the pin output for 500ms.
public Pulse ( ) : void
return void

Pulse() public method

Pulse the pin output for the specified number of milliseconds.
/// An attempt was made to pulse an input pin. ///
public Pulse ( Int32 millis ) : void
millis System.Int32 /// The number of milliseconds to wait between states. ///
return void

Read() public method

Read a value from the pin.
/// Cannot read the value from the pin. The path does not exist. ///
public Read ( ) : PinState
return PinState

Read() public static method

Read a value from the specified pin.
/// The specified pin could not be read (device does path does not exist). ///
public static Read ( GpioPins pin ) : PinState
pin GpioPins /// The pin to read from. ///
return PinState

Write() public static method

Writes the specified value to the specified GPIO pin.
public static Write ( GpioPins pin, PinState value ) : void
pin GpioPins /// The pin to write the value to. ///
value PinState /// The value to write to the pin. ///
return void

Write() public method

Write the specified value to the pin.
public Write ( PinState value ) : void
value PinState /// The value to write to the pin. ///
return void