[−][src]Struct pca9685_lib::PCA9685
A representation of a PCA9685 Chip
Methods
impl PCA9685
[src]
pub fn new(address: u8, bus: I2c) -> Result<PCA9685, Error>
[src]
Creates a new PCA9865
pub async fn start<'_>(&'_ mut self) -> Result<(), Error>
[src]
Start the PCA9865. The chip needs a little time to start.
pub fn sleep(&mut self) -> Result<(), Error>
[src]
Put the chip into sleep
pub async fn set_prescale_fr<'_>(
&'_ mut self,
frequency: u16,
restart: bool
) -> Result<(), Error>
[src]
&'_ mut self,
frequency: u16,
restart: bool
) -> Result<(), Error>
Set the prescale value from a given frequency.
Warnings
-
In order to change the prescale, the chip must be put into sleep. Make sure that anything important be safetied before use.
-
This function tries to be as close as possible to the given frequency, but it is not 100% accurate.
pub fn read_prescale(&mut self) -> Result<u8, Error>
[src]
Reads the prescale directly from the chip.
pub fn set_channel(
&mut self,
channel: u8,
period_on: (u8, u8),
period_off: (u8, u8)
) -> Result<(), Error>
[src]
&mut self,
channel: u8,
period_on: (u8, u8),
period_off: (u8, u8)
) -> Result<(), Error>
Set the pulse-widths for a channel. Channels range from 0 - 15. Since the device uses 12-bit accuracy, the tuples are arranged as (most_significant, least_significant)
Panics
The channel must be less than 16.
pub async fn set_external_clock<'_>(
&'_ mut self,
clock_speed: u32
) -> Result<(), Error>
[src]
&'_ mut self,
clock_speed: u32
) -> Result<(), Error>
Set to use External Clock
Warnings
- In order to use the EXTCLK pin, the chip must be put to sleep.
- In order to reset this mode, you have to run a power cycle (or software reset).
- Max frequency is 50 Mhz
- Untested
pub fn set_output_mode(&mut self, open_drain: bool) -> Result<(), Error>
[src]
Set the output mode of the chip.
Options:
- Open-Drain
- Totem pole <-- chip default
Warnings
- LEDS with built in zener diodes should only be driven in open drain mode.
- Untested
pub fn get_prescale(&mut self) -> Result<u8, Error>
[src]
Gets the prescale value
Auto Trait Implementations
impl RefUnwindSafe for PCA9685
impl Send for PCA9685
impl !Sync for PCA9685
impl Unpin for PCA9685
impl UnwindSafe for PCA9685
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,