Struct pwm_pca9685::Pca9685

source ·
pub struct Pca9685<I2C> { /* private fields */ }
Expand description

PCA9685 PWM/Servo/LED controller.

Implementations

Create a new instance of the device.

Destroy driver instance, return I²C bus instance.

Enable the controller.

Disable the controller (sleep).

Set the ON counter for the selected channel.

Set the OFF counter for the selected channel.

Set the channel always on.

The turning on is delayed by the value argument.

Set the channel always off.

This takes precedence over the on settings and can be cleared by setting the off counter with set_channel_off.

Set the output logic state

This allows for inversion of the output logic.

Enable using the EXTCLK pin as clock source input.

This setting is sticky. It can only be cleared by a power cycle or a software reset.

Set the prescale value.

The prescale value can be calculated for an update rate with the formula: prescale_value = round(osc_value / (4096 * update_rate)) - 1

The minimum prescale value is 3, which corresonds to an update rate of 1526 Hz. The maximum prescale value is 255, which corresponds to an update rate of 24 Hz.

If you want to control a servo, set a prescale value of 100. This will correspond to a frequency of about 60 Hz, which is the frequency at which servos work.

Internally this function stops the oscillator and restarts it after setting the prescale value if it was running.

Reset the internal state of this driver to the default values.

Note: This does not alter the state or configuration of the device.

This resets the cached configuration register value in this driver to the power-up (reset) configuration of the device.

This needs to be called after performing a reset on the device, for example through an I2C general-call Reset command, which was not done through this driver to ensure that the configurations in the device and in the driver match.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.