[][src]Struct saberrs::sabertooth2x32::PacketSerial

pub struct PacketSerial<T: SabertoothSerial> { /* fields omitted */ }

Interface using the "Packet Serial" protocol with checksum or CRC.

Methods

impl PacketSerial<SabertoothPort>[src]

pub fn new(port: &str) -> Result<PacketSerial<SabertoothPort>>[src]

Open a serial port and return a new instance of PacketSerial with default settings. By default the address is ADDRESS_DEFAULT and the protection type is PacketType::Checksum.

Example

use saberrs::sabertooth2x32::PacketSerial;
let saber = PacketSerial::new("/dev/ttyUSB0");

impl<T: SabertoothSerial> PacketSerial<T>[src]

pub fn with_address(self, address: u8) -> Self[src]

Set the address of the Sabertooth.

Example

use saberrs::sabertooth2x32::PacketSerial;
let saber = PacketSerial::new("/dev/ttyUSB0")?.with_address(129);

pub fn with_packet_type(self, packet_type: PacketType) -> Self[src]

Set the integrity protection type used for the frames.

Example

use saberrs::sabertooth2x32::{PacketSerial, PacketType};
let saber = PacketSerial::new("/dev/ttyUSB0")?.with_packet_type(PacketType::CRC);

Trait Implementations

impl<T: SabertoothSerial> Sabertooth2x32 for PacketSerial<T>[src]

fn stop_motors(&mut self) -> Result<()>[src]

Stop the motors, ie. set both speeds to zero.

impl From<SabertoothPort> for PacketSerial<SabertoothPort>[src]

impl<'_> From<&'_ SabertoothPortShared> for PacketSerial<SabertoothPortShared>[src]

Auto Trait Implementations

impl<T> Send for PacketSerial<T> where
    T: Send

impl<T> Unpin for PacketSerial<T> where
    T: Unpin

impl<T> Sync for PacketSerial<T> where
    T: Sync

impl<T> UnwindSafe for PacketSerial<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for PacketSerial<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]