Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
.idea/
**/*.rs.bk
Cargo.lock
generate-certificate.py
18 changes: 9 additions & 9 deletions src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use ref_swap::OptionRefSwap;
use trussed_core::InterruptFlag;

use crate::{
constants::{INTERRUPT_POLL_MILLISECONDS, PACKET_SIZE},
constants::{INTERRUPT_POLL_INTERVAL, PACKET_SIZE},
pipe::Pipe,
types::Status,
};
Expand Down Expand Up @@ -36,12 +36,12 @@ where
interchange: Requester<'pipe, N>,
initial_milliseconds: u32,
) -> Self {
// 64 bytes, interrupt endpoint polled every 5 milliseconds
// 64 bytes, bInterval 4: 4 ms at Full Speed, 1 ms at High Speed.
let read_endpoint: EndpointOut<'alloc, Bus> =
allocate.interrupt(PACKET_SIZE as u16, INTERRUPT_POLL_MILLISECONDS);
// 64 bytes, interrupt endpoint polled every 5 milliseconds
allocate.interrupt(PACKET_SIZE as u16, INTERRUPT_POLL_INTERVAL);
// 64 bytes, bInterval 4: 4 ms at Full Speed, 1 ms at High Speed.
let write_endpoint: EndpointIn<'alloc, Bus> =
allocate.interrupt(PACKET_SIZE as u16, INTERRUPT_POLL_MILLISECONDS);
allocate.interrupt(PACKET_SIZE as u16, INTERRUPT_POLL_INTERVAL);

let pipe = Pipe::new(
read_endpoint,
Expand All @@ -67,12 +67,12 @@ where
interrupt: Option<&'interrupt OptionRefSwap<'interrupt, InterruptFlag>>,
initial_milliseconds: u32,
) -> Self {
// 64 bytes, interrupt endpoint polled every 5 milliseconds
// 64 bytes, bInterval 4: 4 ms at Full Speed, 1 ms at High Speed.
let read_endpoint: EndpointOut<'alloc, Bus> =
allocate.interrupt(PACKET_SIZE as u16, INTERRUPT_POLL_MILLISECONDS);
// 64 bytes, interrupt endpoint polled every 5 milliseconds
allocate.interrupt(PACKET_SIZE as u16, INTERRUPT_POLL_INTERVAL);
// 64 bytes, bInterval 4: 4 ms at Full Speed, 1 ms at High Speed.
let write_endpoint: EndpointIn<'alloc, Bus> =
allocate.interrupt(PACKET_SIZE as u16, INTERRUPT_POLL_MILLISECONDS);
allocate.interrupt(PACKET_SIZE as u16, INTERRUPT_POLL_INTERVAL);

let pipe = Pipe::with_interrupt(
read_endpoint,
Expand Down
4 changes: 3 additions & 1 deletion src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pub const INTERRUPT_POLL_MILLISECONDS: u8 = 5;
/// Raw USB endpoint `bInterval` value. This is a 4 ms interval at Full Speed
/// and a 1 ms interval at High Speed (`2^(4 - 1)` microframes).
pub const INTERRUPT_POLL_INTERVAL: u8 = 4;

pub const PACKET_SIZE: usize = 64;
Loading