C# 클래스 CyrusBuilt.MonoPi.IO.PCF.PCF8574GpioProvider

This GPIO provider implements the PCF8574 I2C GPIO expansion board as native Pi4J GPIO pins. More information about the board can be found here: http://www.ti.com/lit/ds/symlink/pcf8574.pdf

The PCF8574 is connected via I2C connection to the Raspberry Pi and provides 8 GPIO pins that can be used for either digital input or digital output pins.
상속: IDisposable
파일 보기 프로젝트 열기: cyrusbuilt/MonoPi

공개 프로퍼티들

프로퍼티 타입 설명
PinPollFailed PinPollFailEventHandler
PinStateChanged PinStateChangeEventHandler

공개 메소드들

메소드 설명
Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

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

GetPinMode ( IPCF8574Pin pin ) : PinMode

Gets the mode of the specified pin.

GetPinState ( IPCF8574Pin pin ) : PinState

Gets the current state of the specified pin in the pin cache.

InterruptPoll ( ) : void

Interrupts a poll cycle (if running).

PCF8574GpioProvider ( II2CBus device, Int32 address ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.PCF.PCF8574GpioProvider class with the I2C bus device that is the connection to the PCF8574, and the bus address of the device.

PCF8574GpioProvider ( Int32 address ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.IO.PCF.PCF8574GpioProvider class with the bus address of the device. This overload assumes a Rev 2 or higher board and creates a default I2C connection instance.

Poll ( ) : void

Polls the state of the all the pins once every ~50ms.

SetPinMode ( IPCF8574Pin pin, PinMode mode ) : void

Sets the mode of the specified pin.

SetPinState ( IPCF8574Pin pin, PinState state ) : void

Sets the state of the specified pin.

보호된 메소드들

메소드 설명
OnPinPollFailed ( PinPollFailEventArgs e ) : void

Raises the PinPollFailed event.

OnPinStateChanged ( PinStateChangeEventArgs e ) : void

Raises the PinStateChanged event.

비공개 메소드들

메소드 설명
BackgroundExecutePoll ( ) : void

Executes the poll cycle on a background thread.

ExecutePoll ( ) : void

Polls all the pins on the PCF8574 every ~50ms and refreshes their states. This will fire a state change event for any and all pins that have changed state since the last check. This will also fire a failure event if any exceptions are thrown.

메소드 상세

Dispose() 공개 메소드

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Call Dispose when you are finished using the CyrusBuilt.MonoPi.IO.PCF.PCF8574GpioProvider. The Dispose method leaves the CyrusBuilt.MonoPi.IO.PCF.PCF8574GpioProvider in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.IO.PCF.PCF8574GpioProvider so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.IO.PCF.PCF8574GpioProvider was occupying.
public Dispose ( ) : void
리턴 void

GetPinMode() 공개 메소드

Gets the mode of the specified pin.
/// cannot be null. /// /// This instance has been disposed and can no longer be used. /// /// The specified pin does not exist in the pin cache. ///
public GetPinMode ( IPCF8574Pin pin ) : PinMode
pin IPCF8574Pin /// A pin in the pin cache to get the mode from. ///
리턴 PinMode

GetPinState() 공개 메소드

Gets the current state of the specified pin in the pin cache.
/// cannot be null. /// /// This instance has been disposed and can no longer be used. /// /// The specified pin does not exist in the pin cache. ///
public GetPinState ( IPCF8574Pin pin ) : PinState
pin IPCF8574Pin /// The pin to get the state from. ///
리턴 PinState

InterruptPoll() 공개 메소드

Interrupts a poll cycle (if running).
public InterruptPoll ( ) : void
리턴 void

OnPinPollFailed() 보호된 메소드

Raises the PinPollFailed event.
protected OnPinPollFailed ( PinPollFailEventArgs e ) : void
e PinPollFailEventArgs /// The event arguments. ///
리턴 void

OnPinStateChanged() 보호된 메소드

Raises the PinStateChanged event.
protected OnPinStateChanged ( PinStateChangeEventArgs e ) : void
e PinStateChangeEventArgs /// The event arguments. ///
리턴 void

PCF8574GpioProvider() 공개 메소드

Initializes a new instance of the CyrusBuilt.MonoPi.IO.PCF.PCF8574GpioProvider class with the I2C bus device that is the connection to the PCF8574, and the bus address of the device.
public PCF8574GpioProvider ( II2CBus device, Int32 address ) : System
device II2CBus /// The I2C bus device that is the connection to the PCF8574. ///
address System.Int32 /// The bus address of the device. ///
리턴 System

PCF8574GpioProvider() 공개 메소드

Initializes a new instance of the CyrusBuilt.MonoPi.IO.PCF.PCF8574GpioProvider class with the bus address of the device. This overload assumes a Rev 2 or higher board and creates a default I2C connection instance.
public PCF8574GpioProvider ( Int32 address ) : System
address System.Int32 /// The bus address of the device. ///
리턴 System

Poll() 공개 메소드

Polls the state of the all the pins once every ~50ms.
/// This instance has been disposed and can no longer be used. ///
public Poll ( ) : void
리턴 void

SetPinMode() 공개 메소드

Sets the mode of the specified pin.
/// cannot be null. /// /// This instance has been disposed and can no longer be used. /// /// The specified pin does not exist in the pin cache. ///
public SetPinMode ( IPCF8574Pin pin, PinMode mode ) : void
pin IPCF8574Pin /// The pin to alter. ///
mode PinMode /// The mode to set. ///
리턴 void

SetPinState() 공개 메소드

Sets the state of the specified pin.
/// cannot be null. /// /// This instance has been disposed and can no longer be used. /// /// The specified pin does not exist in the pin cache. /// /// Failed to write the new state to the device. ///
public SetPinState ( IPCF8574Pin pin, PinState state ) : void
pin IPCF8574Pin /// The pin to alter. ///
state PinState /// The state of the pin to set. ///
리턴 void

프로퍼티 상세

PinPollFailed 공개적으로 프로퍼티

Occurs if device polling fails.
public PinPollFailEventHandler PinPollFailed
리턴 PinPollFailEventHandler

PinStateChanged 공개적으로 프로퍼티

Occurs when a pin state changes.
public PinStateChangeEventHandler PinStateChanged
리턴 PinStateChangeEventHandler