C# Class CyrusBuilt.MonoPi.IO.GpioMem

Raspberry Pi GPIO using the direct memory access method. This requires the bcm2835 GPIO library provided by Mike McCauley ([email protected]) at http://www.open.com.au/mikem/bcm2835/index.html. To create the shared object, download the source code from the link above. The standard Makefile compiles a statically linked library. To build a shared object, do: tar -zxf bcm2835-1.3.tar.gz cd bcm2835-1.3/src make libbcm2835.a cc -shared bcm2835.o -o libbcm2835.so Place the shared object in the same directory as the executable and other assemblies.
Inheritance: GpioBase
Show file Open project: cyrusbuilt/MonoPi Class Usage Examples

Public Methods

Method Description
Destroy ( ) : void

Destroy this GPIO factory.

Dispose ( ) : void

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

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

GpioMem ( GpioPins pin ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioMem class with the pin to initialize.

Access to the specified GPIO setup as an output port with an initial value of false (0).

GpioMem ( GpioPins pin, PinMode mode ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioMem class with the pin to initialize and the I/O direction.

Access to the specified GPIO setup with the specified direction with an initial value of LOW (0).

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

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioMem class with the pin to initialize, the I/O direction, and the initial value to write to the pin.

Access to the specified GPIO setup with the specified direction with the specified initial value.

Initialize ( ) : System.Boolean

Initialize the memory access to the GPIO.

Provision ( ) : void

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

Pulse ( ) : void

Pulses the pin 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 the specified Revision 1.0 pin.

Write ( GpioPins pin, PinState value ) : void

Write the specified pin and value.

Write ( PinState value ) : void

Write the specified value to the pin.

Private Methods

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

Exports the pin setting the direction.

UnexportPin ( GpioPins pin ) : void

Unexport the GPIO.

internal_ExportPin ( Int32 pin, PinMode mode ) : void

Export the GPIO setting the direction.

internal_Read ( Int32 pin, String pinname ) : PinState

Read the value of the specified pin.

internal_UnexportPin ( Int32 pin, String gpionum ) : void

Unexports an exported pin.

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

Write the value to the specified pin.

Method Details

Destroy() public static method

Destroy this GPIO factory.
public static Destroy ( ) : void
return void

Dispose() public method

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

GpioMem() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioMem class with the pin to initialize.
Access to the specified GPIO setup as an output port with an initial value of false (0).
public GpioMem ( GpioPins pin ) : System
pin GpioPins /// The pin on the board to access. ///
return System

GpioMem() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioMem class with the pin to initialize and the I/O direction.
Access to the specified GPIO setup with the specified direction with an initial value of LOW (0).
public GpioMem ( 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

GpioMem() public method

Initializes a new instance of the CyrusBuilt.MonoPi.IO.GpioMem class with the pin to initialize, the I/O direction, and the initial value to write to the pin.
Access to the specified GPIO setup with the specified direction with the specified initial value.
public GpioMem ( 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

Initialize() public static method

Initialize the memory access to the GPIO.
public static Initialize ( ) : System.Boolean
return System.Boolean

Provision() public method

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

Pulse() public method

Pulses the pin 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.
public Read ( ) : PinState
return PinState

Read() public static method

Read the specified Revision 1.0 pin.
public static Read ( GpioPins pin ) : PinState
pin GpioPins /// The pin to read. ///
return PinState

Write() public static method

Write the specified pin and value.
public static Write ( GpioPins pin, PinState value ) : void
pin GpioPins /// The pin to write to. ///
value PinState /// The value to write. ///
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