Property | Type | Description | |
---|---|---|---|
NxpPca9685Device | System | ||
OnChannelChanged | void |
Method | Description | |
---|---|---|
CalculateFrequency ( byte preScale, int clockSpeed ) : float |
Calculates the effective frequency from a NxpPca9685Register.PreScale value and clock speed.
|
|
CalculatePreScale ( float frequency, int clockSpeed ) : byte |
Calculates the NxpPca9685Register.PreScale value from a desired frequency and clock speed. Due to scaling only certain frequencies are possible. To get the resulting frequency from the desired frequency it is necessary to re-calcualte the effective frequency back from the pre-scale, i.e. call CalculateFrequency. |
|
Clear ( ) : void |
Clears all channels cleanly, then updates all Channels. To "cleanly" clear the channels, it is necessary to first ensure they are not disabled, set them to zero, then disable them. Otherwise the ON value and the low OFF value remain because writes are ignored when the OFF channel bit 12 is already set. |
|
GetChannelAddress ( int index ) : byte |
Gets the register address of a channel by index.
|
|
ReadAll ( ) : void |
Reads all values from the device and updates properties.
|
|
ReadChannel ( int index ) : |
Reads a whole channel value (on and off), and updates it in Channels.
|
|
ReadChannelOff ( int index ) : int |
Reads the PWM "off" (falling) value of a channel, and updates it in Channels.
|
|
ReadChannelOn ( int index ) : int |
Reads the PWM "on" (rising) value of a channel, and updates it in Channels.
|
|
ReadFrequency ( ) : float |
Reads the pre-scale register and calculates the Frequency (and related properties) based on ClockSpeed.
|
|
ReadMode1 ( ) : NxpPca9685Mode1Bits |
Reads the current value of the NxpPca9685Register.Mode1 register.
|
|
ReadMode2 ( ) : NxpPca9685Mode2Bits |
Reads the current value of the NxpPca9685Register.Mode2 register.
|
|
Restart ( ) : void |
Restarts the device with default options, then updates all properties.
|
|
Restart ( NxpPca9685Mode1Bits options ) : void |
Restarts the device with additional options specified, then updates all properties.
|
|
Sleep ( ) : bool |
Enters sleep mode. Sets the NxpPca9685Register.Mode1 register NxpPca9685Mode1Bits.Sleep bit then waits for ModeSwitchDelay to allow the oscillator to stop. |
|
Wake ( ) : bool |
Leaves sleep mode. Clears the NxpPca9685Register.Mode1 register NxpPca9685Mode1Bits.Sleep bit then waits for ModeSwitchDelay to allow the oscillator to start. |
|
WriteChannel ( int index, NxpPca9685ChannelValue value ) : NxpPca9685Channel |
Writes the "on" and "off" values of a channel together, and updates it in Channels.
|
|
WriteChannelLength ( int index, int length, int delay ) : NxpPca9685Channel |
Calculates the "on" and "off" values of a channel from length (and optional delay), then writes them together, and updates it in Channels.
|
|
WriteChannelMilliseconds ( int index, float length, float delay ) : NxpPca9685Channel |
Calculates the "on" and "off" values of a channel from milliseconds (and optional delay), then writes them together, and updates it in Channels.
|
|
WriteChannelOff ( int index, int value ) : void |
Writes the PWM "off" (falling) value of a channel.
|
|
WriteChannelOn ( int index, int value ) : void |
Writes the PWM "on" (rising) value of a channel.
|
|
WriteFrequency ( float frequency ) : float |
Calculates the pre-scale value from the frequency (according to ClockSpeed) then writes that register, then calls ReadFrequency to update properties. Note the actual frequency may differ to the requested frequency due to clock scale (rounding). The pre-scale can only be set during sleep mode. This method enters Sleep if necessary, then only if the device was awake before, calls Wake afterwards. It's important not to start output unexpectedly to avoid damage, i.e. if the device was sleeping before, the frequency is changed without starting the oscillator. |
Method | Description | |
---|---|---|
Dispose ( bool disposing ) : void |
DisposableObject.Dispose(bool).
|
|
ReadAllChannels ( ) : void |
Reads all channels and updates Channels.
|
Method | Description | |
---|---|---|
NxpPca9685Device ( Windows.Devices.I2c.I2cDevice device, int clockSpeed ) : System | ||
OnChannelChanged ( object sender, |
Writes channel values to the device when the Channels member changes.
|
public static CalculateFrequency ( byte preScale, int clockSpeed ) : float | ||
preScale | byte | Pre-scale value from which to calculate frequency. |
clockSpeed | int | Clock speed with with to calcualte the frequency. |
return | float |
public static CalculatePreScale ( float frequency, int clockSpeed ) : byte | ||
frequency | float |
/// Desired frequency.
/// Must be between |
clockSpeed | int | |
return | byte |
public static GetChannelAddress ( int index ) : byte | ||
index | int | Zero based channel number (0-15) or 16 for the "all call" channel. |
return | byte |
public ReadChannel ( int index ) : |
||
index | int | Zero based channel number (0-15). |
return |
public ReadChannelOff ( int index ) : int | ||
index | int | Zero based channel number (0-15). |
return | int |
public ReadChannelOn ( int index ) : int | ||
index | int | Zero based channel number (0-15). |
return | int |
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 |
return | void |
public WriteChannel ( int index, NxpPca9685ChannelValue value ) : NxpPca9685Channel | ||
index | int | Zero based channel number (0-15) or 16 for the "all call" channel. |
value | NxpPca9685ChannelValue | |
return | NxpPca9685Channel |
public WriteChannelLength ( int index, int length, int delay ) : NxpPca9685Channel | ||
index | int | Zero based channel number (0-15) or 16 for the "all call" channel. |
length | int | Pulse length in clock ticks. |
delay | int | Optional delay in clock ticks. |
return | NxpPca9685Channel |
public WriteChannelMilliseconds ( int index, float length, float delay ) : NxpPca9685Channel | ||
index | int | Zero based channel number (0-15) or 16 for the "all call" channel. |
length | float | /// Pulse length in milliseconds. Cannot be greater than one clock interval (1000 / frequency). /// |
delay | float | Optional delay in milliseconds. Cannot be greater than one clock interval (1000 / frequency). |
return | NxpPca9685Channel |
public WriteChannelOff ( int index, int value ) : void | ||
index | int | Zero based channel number (0-15) or 16 for the "all call" channel. |
value | int | 12-bit channel value in the range 0- |
return | void |
public WriteChannelOn ( int index, int value ) : void | ||
index | int | Zero based channel number (0-15) or 16 for the "all call" channel. |
value | int | 12-bit channel value in the range 0- |
return | void |
public WriteFrequency ( float frequency ) : float | ||
frequency | float | Frequency to convert in Hz. |
return | float |