1
2
3
4
5
6
7
8
9
use serialport::SerialPort;
use crate::error::Error;

pub fn read_sized<const N: usize> (usart: &mut Box<dyn SerialPort>) -> Result<[u8; N], Error> {
	let mut buf: [u8; N] = [0; N];
	
	usart.read(&mut buf)?;
	Ok(buf)
}