mirror of
https://github.com/Astatin3/CC2.git
synced 2026-06-08 16:08:00 -06:00
Do some research on the MCU protocol
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "serial-test"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.102"
|
||||
serialport = "4.9.0"
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
cross build --release --target armv7-unknown-linux-musleabihf
|
||||
sshpass -p MTY4ODE2 scp ./target/armv7-unknown-linux-musleabihf/release/serial-test root@192.168.0.86:/root/
|
||||
@@ -0,0 +1,17 @@
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::{Read, Write};
|
||||
use std::time::Duration;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let mut dev = OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.open("/dev/rpmsg1")?;
|
||||
|
||||
let mut buf = [0u8; 4096];
|
||||
|
||||
loop {
|
||||
let n = dev.read(&mut buf)?;
|
||||
println!("rpmsg read {n} bytes: {:02x?}", &buf[..n]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user