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
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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