pub fn sync_write_u16<Iter, Data>(&mut self, address: u16, data: Iter) -> Result<(), WriteError>
	where
		Iter: IntoIterator<Item = Data>,
		Iter::IntoIter: std::iter::ExactSizeIterator,
		Data: AsRef<SyncData<u16>>,
	{
		let data = data.into_iter();
		let count = core::mem::size_of::<u16>();
		let motors = data.len();
		let stride = 1 + count;
		let parameter_count = 4 + motors * stride;
		self.write_instruction(packet_id::BROADCAST, instruction_id::SYNC_WRITE, parameter_count, |buffer| {
			write_u16_le(&mut buffer[0..], address);
			write_u16_le(&mut buffer[2..], count as u16);
			for (i, command) in data.enumerate() {
				let command = command.as_ref();
				let buffer = &mut buffer[4 + i * stride..][..stride];
				buffer[0] = command.motor_id;
				write_u16_le(&mut buffer[1..], command.data);
			}
		})
	}
/// Synchronously write a 16 bit value to multiple motors.
///
/// Each motor will perform the write as soon as it receives the command.
/// This gives much shorter delays than executing a regular [`Self::write`] for each motor individually.
Synchronously write a 16 bit value to multiple motors.
Each motor will perform the write as soon as it receives the command.
This gives much shorter delays than executing a regular [`Self::write`] for each motor individually.
Synchronously write a 16 bit value to multiple motors . Each motor will perform the write as soon as it receives the command . This gives much shorter delays than executing a regular [ ` Self :: write ` ] for each motor individually .
pub fn sync_write_u16<Iter, Data>(&mut self, address: u16, data: Iter) -> Result<(), WriteError>
	where
		Iter: IntoIterator<Item = Data>,
		Iter::IntoIter: std::iter::ExactSizeIterator,
		Data: AsRef<SyncData<u16>>,
	{
		let data = data.into_iter();
		let count = core::mem::size_of::<u16>();
		let motors = data.len();
		let stride = 1 + count;
		let parameter_count = 4 + motors * stride;
		self.write_instruction(packet_id::BROADCAST, instruction_id::SYNC_WRITE, parameter_count, |buffer| {
			write_u16_le(&mut buffer[0..], address);
			write_u16_le(&mut buffer[2..], count as u16);
			for (i, command) in data.enumerate() {
				let command = command.as_ref();
				let buffer = &mut buffer[4 + i * stride..][..stride];
				buffer[0] = command.motor_id;
				write_u16_le(&mut buffer[1..], command.data);
			}
		})
	}
pub fn sync_write_u16 < Iter , Data > ( & mut self , address : u16 , data : Iter ) -> Result < ( ) , WriteError > where Iter : IntoIterator < Item = Data > , Iter :: IntoIter : std :: iter :: ExactSizeIterator , Data : AsRef < SyncData < u16 > > , { let data = data . into_iter ( ) ; let count = core :: mem :: size_of :: < u16 > ( ) ; let motors = data . len ( ) ; let stride = 1 + count ; let parameter_count = 4 + motors * stride ; self . write_instruction ( packet_id :: BROADCAST , instruction_id :: SYNC_WRITE , parameter_count , | buffer | { write_u16_le ( & mut buffer [ 0 .. ] , address ) ; write_u16_le ( & mut buffer [ 2 .. ] , count as u16 ) ; for ( i , command ) in data . enumerate ( ) { let command = command . as_ref ( ) ; let buffer = & mut buffer [ 4 + i * stride .. ] [ .. stride ] ; buffer [ 0 ] = command . motor_id ; write_u16_le ( & mut buffer [ 1 .. ] , command . data ) ; } } ) }
Synchronously write a 16 bit value to multiple motors.
Synchronously write a 16 bit value to multiple motors .
&mut self
address
u16
data
Iter
&mut self
address
u16
data
Iter