PCA9685

Struct PCA9685 

Source
pub struct PCA9685 { /* private fields */ }

Implementations§

Source§

impl PCA9685

Source

pub fn default(board: &Board) -> Result<Self, Error>

Source

pub fn new(board: &dyn Hardware, address: u8) -> Result<Self, Error>

Source

pub fn get_address(&self) -> u8

Source

pub fn get_frequency(&self) -> u16

Source

pub fn set_frequency(&mut self, frequency: u16) -> Result<&Self, Error>

Source

pub fn write_to_reg(&mut self, register: u8, value: u8) -> Result<(), Error>

Source

pub fn read_from_reg(&mut self, register: u8) -> Result<u8, Error>

Trait Implementations§

Source§

impl Clone for PCA9685

Source§

fn clone(&self) -> PCA9685

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PCA9685

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PCA9685

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hardware for PCA9685

Source§

fn get_protocol(&self) -> Box<dyn IoProtocol>

Returns the protocol used.
Source§

fn set_protocol(&mut self, protocol: Box<dyn IoProtocol>)

Sets the protocol. @todo remove this when hermes_studio finds a way around.
Source§

fn get_protocol_name(&self) -> &str

Returns the protocol name.
Source§

impl IO for PCA9685

Source§

fn get_io(&self) -> &Arc<RwLock<IoData>>

Returns a protected arc to the inner IoData.
Source§

fn is_connected(&self) -> bool

Checks if the communication is opened using the underlying protocol.
Source§

fn set_pin_mode(&mut self, pin: u8, mode: PinModeId) -> Result<(), Error>

Sets the mode of the specified pin. Read more
Source§

fn digital_write(&mut self, pin: u8, level: bool) -> Result<(), Error>

Writes level to the digital pin. Read more
Source§

fn analog_write(&mut self, pin: u8, level: u16) -> Result<(), Error>

Writes level to the analog pin. Read more
Source§

fn digital_read(&mut self, _: u8) -> Result<bool, Error>

Reads the digital pin value.
Source§

fn analog_read(&mut self, _: u8) -> Result<u16, Error>

Reads the analog pin value.
Source§

fn servo_config(&mut self, pin: u8, pwm_range: Range<u16>) -> Result<(), Error>

Sends a SERVO_CONFIG command (0x70 - configure servo) https://github.com/firmata/protocol/blob/master/servos.md
Source§

fn i2c_config(&mut self, delay: u16) -> Result<(), Error>

Configures the delay in microseconds for I2C devices that require a delay between when the register is written to and the data in that register can be read.
Source§

fn i2c_read(&mut self, address: u8, size: u16) -> Result<(), Error>

Reads size bytes from I2C device at the specified address.
Source§

fn i2c_write(&mut self, address: u8, data: &[u16]) -> Result<(), Error>

Writes data to the I2C device at the specified address.
Source§

impl IoProtocol for PCA9685

Source§

fn open(&mut self) -> Result<(), Error>

Opens the communication using the underlying protocol.
Source§

fn close(&mut self) -> Result<(), Error>

Gracefully shuts down the communication.
Source§

fn report_analog(&mut self, _: u8, _: bool) -> Result<(), Error>

Sets the analog reporting state of the specified analog pin. Read more
Source§

fn report_digital(&mut self, _: u8, _: bool) -> Result<(), Error>

Sets the digital reporting state of the specified digital pin. Read more
Source§

fn sampling_interval(&mut self, _: u16) -> Result<(), Error>

Set the sampling interval (in ms). Read more
Source§

fn get_name(&self) -> &'static str

Returns the protocol name.
Source§

impl Expander for PCA9685

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.