fix: send only bytes written to the buffer instead of the entire buffer

This commit is contained in:
doryan 2025-05-27 21:27:11 +04:00
parent f069c3b4b2
commit e915deb1d5

View File

@ -109,14 +109,14 @@ where
crate::_priv_write_bytes::<P>(data);
}
#[inline(never)]
fn write_bytes(&self, transmit_data: &mut RingBuffer<N>) {
<Self as SoftSerialWriter<P, &mut RingBuffer<N>>>::write_byte(
self,
transmit_data.len() as u8,
);
for _ in 0..N {
let byte = transmit_data.pop().unwrap_or(0);
for byte in transmit_data {
self.sync_transmitter();
<Self as SoftSerialWriter<P, &mut RingBuffer<N>>>::write_byte(self, byte);
}
@ -132,6 +132,7 @@ where
crate::_priv_read_byte::<P>()
}
#[inline(never)]
fn read_bytes(&self, recieve_data: &mut RingBuffer<N>) {
let byte = <Self as SoftSerialReader<P, &mut RingBuffer<N>>>::read_byte(self);