C# Class Emlid.WindowsIot.Hardware.Boards.Navio.NavioLedPwmDevice

Navio LED & PWM servo driver (PCA9685 hardware device), connected via I2C.
Navio uses the NxpPca9685Device as a dual-purpose PWM and LED driver, i.e. for servo control and the high intensity RGB status LED. It is connected via the I2C bus. See http://docs.emlid.com/Navio-dev/servo-and-rgb-led/ for more information. NxpPca9685Device
Inheritance: Emlid.WindowsIot.Hardware.Components.NxpPca9685.NxpPca9685Device
显示文件 Open project: emlid/Navio-SDK-Windows-IoT Class Usage Examples

Public Methods

Method Description
Initialize ( float frequency, bool clear = true, bool restart = true, bool enable = false ) : NavioLedPwmDevice

Creates an initialized instance.

ReadAll ( ) : void

Reads all values from the device and updates properties.

Restart ( NxpPca9685Mode1Bits options ) : void

Restarts the device with additional options specified, then updates all properties.

SetLed ( int red, int green, int blue ) : void

Sets RGB values of the high intensity LED together (in one operation).

Automatically inverts the value, providing a natural behaviour where a higher number produces a higher LED intensity. Normally, when written as raw PWM values, the output is inverted due to common anode.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Frees resources owned by this instance.

Private Methods

Method Description
NavioLedPwmDevice ( Windows.Devices.I2c.I2cDevice device ) : System
OnLedBlueChannelChanged ( object sender, EventArgs arguments ) : void

Updates the LedBlue property when the related channel changed.

OnLedGreenChannelChanged ( object sender, EventArgs arguments ) : void

Updates the LedGreen property when the related channel changed.

OnLedRedChannelChanged ( object sender, EventArgs arguments ) : void

Updates the LedRed property when the related channel changed.

ReadLed ( ) : void

Reads the LED channels from the device, calculates then updates the related properties.

Method Details

Dispose() protected method

Frees resources owned by this instance.
protected Dispose ( bool disposing ) : void
disposing bool /// True when called via , false when called from the finalizer. ///
return void

Initialize() public static method

Creates an initialized instance.
public static Initialize ( float frequency, bool clear = true, bool restart = true, bool enable = false ) : NavioLedPwmDevice
frequency float /// for important information. /// Use to support most analog servos. ///
clear bool Clears all LED/PWM values.
restart bool /// Set true to restart the device which also enables the osciallator. /// When false, you have to call or later to enable the oscillator. ///
enable bool /// Set true to enable output, or false to continue with further initialization before enabling output. /// When false, you have to set it later before any output can occur. /// Defaults to false to prevent unexpected behaviour from damaging hardware. ///
return NavioLedPwmDevice

ReadAll() public method

Reads all values from the device and updates properties.
public ReadAll ( ) : void
return void

Restart() public method

Restarts the device with additional options specified, then updates all properties.
public Restart ( NxpPca9685Mode1Bits options ) : void
options NxpPca9685Mode1Bits /// Optional mode 1 parameters to add to the final restart sequence. A logical OR is applied to this value and /// the standard , , /// and bits. ///
return void

SetLed() public method

Sets RGB values of the high intensity LED together (in one operation).
Automatically inverts the value, providing a natural behaviour where a higher number produces a higher LED intensity. Normally, when written as raw PWM values, the output is inverted due to common anode.
public SetLed ( int red, int green, int blue ) : void
red int Red value in the range 0-.
green int Green value in the range 0-.
blue int Blue value in the range 0-.
return void