Upgrade to development build of profirust
This commit is contained in:
parent
fa2d012fd3
commit
8374ecda1f
3 changed files with 14 additions and 9 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
|
@ -164,8 +164,7 @@ checksum = "a5af8362e66e347fba28d90c6569235402c7f1b7e41a4a67ed85ca29efade4b0"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "profirust"
|
name = "profirust"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/rahix/profirust.git?rev=6274541806f2b5fb8cfdffb641ca8fa452806c81#6274541806f2b5fb8cfdffb641ca8fa452806c81"
|
||||||
checksum = "815ad0b21c66b9772b138d0040b36bc63fc893b780658eabceba417f9ba0d1b8"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"bitvec",
|
"bitvec",
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,10 @@ edition = "2021"
|
||||||
env_logger = "0.11.3"
|
env_logger = "0.11.3"
|
||||||
log = "0.4.21"
|
log = "0.4.21"
|
||||||
process-image = "0.2.0"
|
process-image = "0.2.0"
|
||||||
profirust = { version = "0.2.0", default-features = false, features = ["phy-linux", "std"] }
|
|
||||||
|
[dependencies.profirust]
|
||||||
|
# version = 0.2.0
|
||||||
|
git = "https://github.com/rahix/profirust.git"
|
||||||
|
rev = "6274541806f2b5fb8cfdffb641ca8fa452806c81"
|
||||||
|
default-features = false
|
||||||
|
features = ["phy-linux", "std"]
|
||||||
|
|
|
||||||
12
src/main.rs
12
src/main.rs
|
|
@ -169,7 +169,7 @@ fn main() {
|
||||||
.with_diag_buffer(&mut buffer_diagnostics),
|
.with_diag_buffer(&mut buffer_diagnostics),
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut fdl_master = fdl::FdlMaster::new(
|
let mut fdl = fdl::FdlActiveStation::new(
|
||||||
fdl::ParametersBuilder::new(MASTER_ADDRESS, BAUDRATE)
|
fdl::ParametersBuilder::new(MASTER_ADDRESS, BAUDRATE)
|
||||||
// We use a rather large T_slot time because USB-RS485 converters
|
// We use a rather large T_slot time because USB-RS485 converters
|
||||||
// can induce large delays at times.
|
// can induce large delays at times.
|
||||||
|
|
@ -178,19 +178,19 @@ fn main() {
|
||||||
.build_verified(&dp_master),
|
.build_verified(&dp_master),
|
||||||
);
|
);
|
||||||
// We must not poll() too often or to little. T_slot / 2 seems to be a good compromise.
|
// We must not poll() too often or to little. T_slot / 2 seems to be a good compromise.
|
||||||
let sleep_time: std::time::Duration = (fdl_master.parameters().slot_time() / 2).into();
|
let sleep_time: std::time::Duration = (fdl.parameters().slot_time() / 2).into();
|
||||||
|
|
||||||
let mut phy = phy::LinuxRs485Phy::new(BUS_DEVICE, fdl_master.parameters().baudrate);
|
let mut phy = phy::LinuxRs485Phy::new(BUS_DEVICE, fdl.parameters().baudrate);
|
||||||
|
|
||||||
let start = profirust::time::Instant::now();
|
let _start = profirust::time::Instant::now();
|
||||||
let mut pii = [0u8; 1024];
|
let mut pii = [0u8; 1024];
|
||||||
let mut piq = [0u8; 1024];
|
let mut piq = [0u8; 1024];
|
||||||
|
|
||||||
fdl_master.set_online();
|
fdl.set_online();
|
||||||
dp_master.enter_operate();
|
dp_master.enter_operate();
|
||||||
loop {
|
loop {
|
||||||
let now = profirust::time::Instant::now();
|
let now = profirust::time::Instant::now();
|
||||||
let events = fdl_master.poll(now, &mut phy, &mut dp_master);
|
let events = fdl.poll(now, &mut phy, &mut dp_master);
|
||||||
|
|
||||||
if events.cycle_completed {
|
if events.cycle_completed {
|
||||||
let remoteio = dp_master.get_mut(rio_handle);
|
let remoteio = dp_master.get_mut(rio_handle);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue