[−][src]Struct saberrs::sabertooth2x32::PacketSerial
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 startup(&mut self, channel: usize) -> Result<()>
[src]
fn shutdown(&mut self, channel: usize) -> Result<()>
[src]
fn set_speed(&mut self, channel: usize, percent: f32) -> Result<()>
[src]
fn get_speed(&mut self, channel: usize) -> Result<f32>
[src]
fn set_drive(&mut self, percent: f32) -> Result<()>
[src]
fn set_turn(&mut self, percent: f32) -> Result<()>
[src]
fn set_power(&mut self, channel: usize, percent: f32) -> Result<()>
[src]
fn get_power(&mut self, channel: usize) -> Result<f32>
[src]
fn set_ramp(&mut self, channel: usize, percent: f32) -> Result<()>
[src]
fn set_aux(&mut self, channel: usize, percent: f32) -> Result<()>
[src]
fn get_voltage(&mut self, channel: usize) -> Result<f32>
[src]
fn get_current(&mut self, channel: usize) -> Result<f32>
[src]
fn get_temperature(&mut self, channel: usize) -> Result<f32>
[src]
fn stop_motors(&mut self) -> Result<()>
[src]
Stop the motors, ie. set both speeds to zero.
impl From<SabertoothPort> for PacketSerial<SabertoothPort>
[src]
fn from(dev: SabertoothPort) -> Self
[src]
impl<'_> From<&'_ SabertoothPortShared> for PacketSerial<SabertoothPortShared>
[src]
fn from(dev: &SabertoothPortShared) -> Self
[src]
Auto Trait Implementations
impl<T> Send for PacketSerial<T> where
T: Send,
T: Send,
impl<T> Unpin for PacketSerial<T> where
T: Unpin,
T: Unpin,
impl<T> Sync for PacketSerial<T> where
T: Sync,
T: Sync,
impl<T> UnwindSafe for PacketSerial<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for PacketSerial<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,