C# Класс CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase

Base class for Microchip MCP45XX and MCP46XX IC device abstraction components.
Наследование: ComponentBase, IMicrochipPotentiometer
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
_nonVolMode MicrochipPotNonVolatileMode

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

Метод Описание
Decrease ( ) : void

Decreases the wiper's value by one step. It is not an error if the wiper already hit the lower boundary (0). In this situation, the wiper doesn't change.

Decrease ( Int32 steps ) : void

Decreases the wiper's value by the specified number of steps. It is not an error if the wiper hits or already hit the lower boundary (0). In such situations, the wiper sticks to the lower boundary or doesn't change.

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.MicrochipPotentiometerBase. The Dispose method leaves the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase was occupying.

Increase ( ) : void

Increase the wiper's value by one step. It is not an error if the wiper already hit the upper boundary. In this situation, the wiper doesn't change.

Increase ( Int32 steps ) : void

Increases the wiper's value by the specified number of steps. It is not an error if the wiper hits or already hit the upper boundary. In such situations, the wiper sticks to the upper boundary or doesn't change.

IsChannelSupported ( MicrochipPotChannel channel ) : System.Boolean

Determines whether or not the specified channel is supported by the underlying device.

SetWiperLock ( System.Boolean enabled ) : void

Enables or disables the wiper lock.

SetWriteProtection ( System.Boolean enabled ) : void

Enables or disables write-protection for devices capable of non-volatile memory. Enabling write-protection does not only protect non-volatile wipers, it also protects any other non-volatile information stored (i.e. wiper-locks).

UpdateCacheFromDevice ( ) : Int32

Updates the cache to the wiper's value.

Защищенные методы

Метод Описание
BuildI2CAddress ( System.Boolean pinA0, System.Boolean pinA1, System.Boolean pinA2 ) : Int32

Builds the I2C bus address of the device based on which which address pins are set.

GetNonVolatileValue ( ) : Int32

Gets the non-volatile wiper's value.

The visibility of this method is protected because not all devices support non-volatile wipers. Any derived class may publish this method.

Initialize ( Int32 initialValForNonVolWipers ) : void

Initializes the wiper to a defined status. For devices capable of non-volatile wipers, the non-volatile value is loaded. For devices not capable, the given value is set in the device.

MicrochipPotentiometerBase ( II2CBus device, System.Boolean pinA0, System.Boolean pinA1, System.Boolean pinA2, MicrochipPotChannel channel, MicrochipPotNonVolatileMode nonVolatileMode, Int32 initialNonVolWiperValue ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase class with the I2C device connection, pin A0,A1, and A2 states, the potentiometer (channel) provided by the device, how to do non-volatile I/O and the initial value for devices which are not capable of non-volatile wipers.

SetNonVolatileMode ( MicrochipPotNonVolatileMode mode ) : void

Sets the non-volatility mode.

The visibility of this method is protected because not all devices support non-volatile wipers. Any derived class may publish this method.

Приватные методы

Метод Описание
GetValueAccordingBoundaries ( Int32 val ) : Int32

Adjusts the given value according to the boundaries (0 and CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase.MaxValue).

MicrochipPotentiometerBase_WiperActionEvent ( object sender, WiperEventArgs e ) : void

The potentiometer base wiper action event handler. This sets the channel value for either volatile or non-volatile wipers (depending on volatilty mode).

OnWiperActionEvent ( WiperEventArgs e ) : void

Raises the wiper action event event.

Описание методов

BuildI2CAddress() защищенный статический Метод

Builds the I2C bus address of the device based on which which address pins are set.
protected static BuildI2CAddress ( System.Boolean pinA0, System.Boolean pinA1, System.Boolean pinA2 ) : Int32
pinA0 System.Boolean /// Whether the device's address pin A0 is high (true) or low (false). ///
pinA1 System.Boolean /// Whether the device's address pin A1 (if available) is high (true) or low (false). ///
pinA2 System.Boolean /// Whether the device's address pin A2 (if available) is high (true) or low (false). ///
Результат System.Int32

Decrease() публичный Метод

Decreases the wiper's value by one step. It is not an error if the wiper already hit the lower boundary (0). In this situation, the wiper doesn't change.
/// Communication with the device failed. ///
public Decrease ( ) : void
Результат void

Decrease() публичный Метод

Decreases the wiper's value by the specified number of steps. It is not an error if the wiper hits or already hit the lower boundary (0). In such situations, the wiper sticks to the lower boundary or doesn't change.
/// Communication with the device failed. ///
public Decrease ( Int32 steps ) : void
steps System.Int32 /// The number of steps to decrease by. ///
Результат 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.MicrochipPotentiometerBase. The Dispose method leaves the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase in an unusable state. After calling Dispose, you must release all references to the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase so the garbage collector can reclaim the memory that the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase was occupying.
public Dispose ( ) : void
Результат void

GetNonVolatileValue() защищенный Метод

Gets the non-volatile wiper's value.
The visibility of this method is protected because not all devices support non-volatile wipers. Any derived class may publish this method.
/// Communication with device failed or malformed result. /// /// The device is not capable of non-volatile wipers. ///
protected GetNonVolatileValue ( ) : Int32
Результат System.Int32

Increase() публичный Метод

Increase the wiper's value by one step. It is not an error if the wiper already hit the upper boundary. In this situation, the wiper doesn't change.
/// Communication with the device failed. ///
public Increase ( ) : void
Результат void

Increase() публичный Метод

Increases the wiper's value by the specified number of steps. It is not an error if the wiper hits or already hit the upper boundary. In such situations, the wiper sticks to the upper boundary or doesn't change.
/// Communication with the device failed. ///
public Increase ( Int32 steps ) : void
steps System.Int32 /// How many steps to increase. ///
Результат void

Initialize() защищенный Метод

Initializes the wiper to a defined status. For devices capable of non-volatile wipers, the non-volatile value is loaded. For devices not capable, the given value is set in the device.
/// Communication with device failed or malformed result. ///
protected Initialize ( Int32 initialValForNonVolWipers ) : void
initialValForNonVolWipers System.Int32 /// The initial value for devices not capable of non-volatile wipers. ///
Результат void

IsChannelSupported() публичный Метод

Determines whether or not the specified channel is supported by the underlying device.
public IsChannelSupported ( MicrochipPotChannel channel ) : System.Boolean
channel MicrochipPotChannel /// The channel to check. ///
Результат System.Boolean

MicrochipPotentiometerBase() защищенный Метод

Initializes a new instance of the CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase class with the I2C device connection, pin A0,A1, and A2 states, the potentiometer (channel) provided by the device, how to do non-volatile I/O and the initial value for devices which are not capable of non-volatile wipers.
/// cannot be null. - or - /// cannot be null. /// /// is not supported by this device. /// /// Unable to open the I2C bus. ///
protected MicrochipPotentiometerBase ( II2CBus device, System.Boolean pinA0, System.Boolean pinA1, System.Boolean pinA2, MicrochipPotChannel channel, MicrochipPotNonVolatileMode nonVolatileMode, Int32 initialNonVolWiperValue ) : System
device II2CBus /// The I2C bus device this instance is connected to. ///
pinA0 System.Boolean /// Whether the device's address pin A0 is high (true) or low (false). ///
pinA1 System.Boolean /// Whether the device's address pin A1 is high (true) or low (false). ///
pinA2 System.Boolean /// Whether the device's address pin A2 is high (true) or low (false). ///
channel MicrochipPotChannel /// Which of the potentiometers provided by the device to control. ///
nonVolatileMode MicrochipPotNonVolatileMode /// The way non-volatile reads or writes are done. ///
initialNonVolWiperValue System.Int32 /// The value for devices which are not capable of non-volatile wipers. ///
Результат System

SetNonVolatileMode() защищенный Метод

Sets the non-volatility mode.
The visibility of this method is protected because not all devices support non-volatile wipers. Any derived class may publish this method.
/// This device is not capable of non-volatile wipers. ///
protected SetNonVolatileMode ( MicrochipPotNonVolatileMode mode ) : void
mode MicrochipPotNonVolatileMode /// The way non-volatile reads or writes are done. ///
Результат void

SetWiperLock() публичный Метод

Enables or disables the wiper lock.
/// Communication with device failed or malformed result. ///
public SetWiperLock ( System.Boolean enabled ) : void
enabled System.Boolean /// Set true to enable. ///
Результат void

SetWriteProtection() публичный Метод

Enables or disables write-protection for devices capable of non-volatile memory. Enabling write-protection does not only protect non-volatile wipers, it also protects any other non-volatile information stored (i.e. wiper-locks).
/// Communication with device failed or malformed result. ///
public SetWriteProtection ( System.Boolean enabled ) : void
enabled System.Boolean /// Set true to enable. ///
Результат void

UpdateCacheFromDevice() публичный Метод

Updates the cache to the wiper's value.
/// Communication with device failed or malformed result. ///
public UpdateCacheFromDevice ( ) : Int32
Результат System.Int32

Описание свойств

_nonVolMode защищенное свойство

protected MicrochipPotNonVolatileMode _nonVolMode
Результат MicrochipPotNonVolatileMode