make serial core functions public
This commit is contained in:
@@ -45,7 +45,7 @@ impl PacketTransportSerialCobs {
|
||||
/// Send a packet.
|
||||
///
|
||||
/// It encodes the packet using COBS encoding before sending it over the serial port.
|
||||
fn send(&mut self, packet: &[u8]) -> Result<(), super::SendError> {
|
||||
pub fn send(&mut self, packet: &[u8]) -> Result<(), super::SendError> {
|
||||
let encoded = cobs::encode_vec_including_sentinels(packet);
|
||||
log::debug!("sending COBS encoded packet: {:?}", encoded);
|
||||
self.serial.write_all(&encoded)?;
|
||||
@@ -57,7 +57,7 @@ impl PacketTransportSerialCobs {
|
||||
/// This function pulls bytes from the serial port and feeds them into the COBS decoder.
|
||||
/// For each received packet, the closure will be called with the decoded packet as an argument.
|
||||
/// The function will return the number of received packets.
|
||||
fn receive<F: FnMut(&[u8])>(&mut self, mut f: F) -> Result<usize, super::ReceiveError> {
|
||||
pub fn receive<F: FnMut(&[u8])>(&mut self, mut f: F) -> Result<usize, super::ReceiveError> {
|
||||
let mut decoded_packets = 0;
|
||||
loop {
|
||||
let read_bytes = self.serial.read(&mut self.reception_buffer)?;
|
||||
|
||||
Reference in New Issue
Block a user