Skip to content

Commit

Permalink
Expose clutch
Browse files Browse the repository at this point in the history
  • Loading branch information
aMarcireau committed Apr 22, 2024
1 parent c4d8d50 commit e3e8fa9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = [
"Alexandre Marcireau",
]
description = "Neuromorphic devices drivers"
version = "0.13.0"
version = "0.13.1"
edition = "2021"
license-file = "../LICENSE"
homepage = "https://github.com/neuromorphicsystems/neuromorphic-rs/"
Expand Down
2 changes: 2 additions & 0 deletions drivers/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ pub trait Usb: Sized {

fn backlog(&self) -> usize;

fn clutch(&self) -> usb::Clutch;

fn serial(&self) -> String;

fn chip_firmware_configuration(&self) -> Self::Configuration;
Expand Down
4 changes: 4 additions & 0 deletions drivers/src/devices/prophesee_evk3_hd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ impl device::Usb for Device {
self.ring.backlog()
}

fn clutch(&self) -> usb::Clutch {
self.ring.clutch()
}

fn serial(&self) -> String {
self.serial.clone()
}
Expand Down
4 changes: 4 additions & 0 deletions drivers/src/devices/prophesee_evk4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,10 @@ impl device::Usb for Device {
self.ring.backlog()
}

fn clutch(&self) -> usb::Clutch {
self.ring.clutch()
}

fn serial(&self) -> String {
self.serial.clone()
}
Expand Down
9 changes: 9 additions & 0 deletions drivers/src/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,15 @@ impl Ring {
(shared.write_range.start + shared.buffers.len() - 1 - shared.read) % shared.buffers.len()
}

pub fn clutch(&self) -> Clutch {
let shared = self
.context
.shared
.lock()
.expect("ring context's lock is not poisoned");
shared.clutch
}

pub fn next_with_timeout(&self, duration: &std::time::Duration) -> Option<BufferView> {
if self
.active_buffer_view
Expand Down

0 comments on commit e3e8fa9

Please sign in to comment.