use rpi_embedded::uart::Uart;
use rpi_embedded::uart::Parity;
use std::time::Duration;
use std::thread;
fn main(){
let mut uart = Uart::new(115_200, Parity::None, 8, 1).unwrap();
uart.set_read_mode(1, Duration::default()).unwrap();
uart.write(String::from("Hello there \n")).unwrap();
let res_1 = uart.read_until('\n').unwrap(); println!("Result 1| {}",res_1);
thread::sleep(Duration::from_millis(500));
uart.write(String::from("good day \n")).unwrap();
let res_2 = uart.read_line().unwrap(); println!("Result 2| {}",res_2);
thread::sleep(Duration::from_millis(500));
let mut buffer = [0u32;24];
uart.write(String::from("52,53,54\n")).unwrap();
let k = uart.read_csv(&mut buffer).unwrap();
print!("Result 3| {}",buffer[0]);
for j in 1..k {
print!(",{}",buffer[(j) as usize])
}
println!("");
}