use super::{instruction_id, packet_id};
use crate::{Bus, Response, TransferError, WriteError};
impl<ReadBuffer, WriteBuffer> Bus<ReadBuffer, WriteBuffer>
where
ReadBuffer: AsRef<[u8]> + AsMut<[u8]>,
WriteBuffer: AsRef<[u8]> + AsMut<[u8]>,
{
pub fn action(&mut self, motor_id: u8) -> Result<Response<()>, TransferError> {
self.write_instruction(motor_id, instruction_id::ACTION, 0, |_| ())?;
Ok(super::read_response_if_not_broadcast(self, motor_id)?)
}
pub fn broadcast_action(&mut self) -> Result<(), WriteError> {
self.write_instruction(packet_id::BROADCAST, instruction_id::ACTION, 0, |_| ())
}
}