C# 클래스 CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController

An MCP45XX and MCP46XX device controller component. This mostly a port of the device controller in the Pi4J project (Java port author Raspelikan) which is a port of similar C++ code from Stibro's code blog.
상속: IDisposable
파일 보기 프로젝트 열기: cyrusbuilt/MonoPi 1 사용 예제들

공개 메소드들

메소드 설명
Decrease ( DeviceControlChannel channel, Int32 steps ) : void

Decriments the volatile wiper for the given number of steps.

Dispose ( ) : void

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

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

GetTerminalConfiguration ( DeviceControlChannel channel ) : DeviceControllerTerminalConfiguration

Gets the terminal configuration for the specified channel.

GetValue ( DeviceControlChannel channel, System.Boolean nonVolatile ) : Int32

Receives the current wiper's value from the device.

Increase ( DeviceControlChannel channel, Int32 steps ) : void

Increments the volatile wiper for the given number of steps.

MicrochipPotDeviceController ( II2CBus device, Int32 busAddress ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController class with the I2C bus device this instance is connected to and the bus address of that device.

SetTerminalConfiguration ( DeviceControllerTerminalConfiguration config ) : void

Sets the device's terminal configuration.

SetValue ( DeviceControlChannel channel, Int32 value, System.Boolean nonVolatile ) : void

Sets the wiper's value in the device.

SetWiperLock ( DeviceControlChannel channel, System.Boolean locked ) : void

Enables or disables the wiper's lock.

SetWriteProtection ( System.Boolean enabled ) : void

Enables or disables the device's write-protection.

비공개 메소드들

메소드 설명
IncreaseOrDecrease ( Byte memAddr, System.Boolean increase, Int32 steps ) : void

Writes n (steps) bytes to the device holding the wiper's address and the increment or decrement command and value.

Read ( Byte memAddr ) : Int32

Reads two bytes from the device at the given memory address.

SetBit ( Int32 mem, Int32 mask, System.Boolean val ) : Int32

Sets or clears a bit in the specified memory (integer).

Write ( Byte memAddr, Int32 val ) : void

Writes 9 bits of the give value to the device.

메소드 상세

Decrease() 공개 메소드

Decriments the volatile wiper for the given number of steps.
/// This instance has been disposed and can no longer be used. /// /// cannot be null. /// /// An I/O error occurred. The specified address is inacessible or the /// I2C transaction failed. ///
public Decrease ( DeviceControlChannel channel, Int32 steps ) : void
channel DeviceControlChannel /// The device channel the wiper is on. ///
steps System.Int32 /// The number of steps. ///
리턴 void

Dispose() 공개 메소드

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

GetTerminalConfiguration() 공개 메소드

Gets the terminal configuration for the specified channel.
/// This instance has been disposed and can no longer be used. /// /// cannot be null. /// /// Unable to read from device. ///
public GetTerminalConfiguration ( DeviceControlChannel channel ) : DeviceControllerTerminalConfiguration
channel DeviceControlChannel /// The channel to get the terminal configuration for. ///
리턴 DeviceControllerTerminalConfiguration

GetValue() 공개 메소드

Receives the current wiper's value from the device.
/// This instance has been disposed and can no longer be used. /// /// cannot be null. /// /// Unable to read from device. ///
public GetValue ( DeviceControlChannel channel, System.Boolean nonVolatile ) : Int32
channel DeviceControlChannel /// The device channel the wiper is on. ///
nonVolatile System.Boolean /// Set true to read from non-volatile memory, false to read from /// volatile memory. ///
리턴 System.Int32

Increase() 공개 메소드

Increments the volatile wiper for the given number of steps.
/// This instance has been disposed and can no longer be used. /// /// cannot be null. /// /// An I/O error occurred. The specified address is inacessible or the /// I2C transaction failed. ///
public Increase ( DeviceControlChannel channel, Int32 steps ) : void
channel DeviceControlChannel /// The device channel the wiper is on. ///
steps System.Int32 /// The number of steps. ///
리턴 void

MicrochipPotDeviceController() 공개 메소드

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController class with the I2C bus device this instance is connected to and the bus address of that device.
/// cannot be null. /// /// Unable to open the I2C bus. ///
public MicrochipPotDeviceController ( II2CBus device, Int32 busAddress ) : System
device II2CBus /// The I2C bus device this instance is connected to. ///
busAddress System.Int32 /// The bus address of the device. ///
리턴 System

SetTerminalConfiguration() 공개 메소드

Sets the device's terminal configuration.
/// This instance has been disposed and can no longer be used. /// /// cannot be null. /// /// The specified configuration cannot have a null channel. /// /// An I/O error occurred. The specified address is inacessible or the /// I2C transaction failed. ///
public SetTerminalConfiguration ( DeviceControllerTerminalConfiguration config ) : void
config DeviceControllerTerminalConfiguration /// The configuration to set. ///
리턴 void

SetValue() 공개 메소드

Sets the wiper's value in the device.
/// This instance has been disposed and can no longer be used. /// /// cannot be null. /// /// cannot be a negative. /// /// An I/O error occurred. The specified address is inacessible or the /// I2C transaction failed. ///
public SetValue ( DeviceControlChannel channel, Int32 value, System.Boolean nonVolatile ) : void
channel DeviceControlChannel /// The device channel the wiper is on. ///
value System.Int32 /// The wiper's value. ///
nonVolatile System.Boolean /// Set true to write to non-volatile memory, or false to write to volatile memory. ///
리턴 void

SetWiperLock() 공개 메소드

Enables or disables the wiper's lock.
/// This instance has been disposed and can no longer be used. /// /// cannot be null. /// /// An I/O error occurred. The specified address is inacessible or the /// I2C transaction failed. ///
public SetWiperLock ( DeviceControlChannel channel, System.Boolean locked ) : void
channel DeviceControlChannel /// The channel of the wiper to set the lock for. ///
locked System.Boolean /// Set true to enable the lock, or false to disable. ///
리턴 void

SetWriteProtection() 공개 메소드

Enables or disables the device's write-protection.
/// This instance has been disposed and can no longer be used. /// /// An I/O error occurred. The specified address is inacessible or the /// I2C transaction failed. ///
public SetWriteProtection ( System.Boolean enabled ) : void
enabled System.Boolean /// Set true to enable write protection, or false to disable. ///
리턴 void