Skip to content

Commit

Permalink
Rename symbol duration to symbol period to stay closer to the standard
Browse files Browse the repository at this point in the history
  • Loading branch information
diondokter committed Mar 3, 2025
1 parent 378f214 commit 95e4ce3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lr-wpan-rs-dw1000/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl<SPI: SpiDevice, IRQ: Wait, DELAY: DelayNs> Phy for DW1000Phy<SPI, IRQ, DELA
Ok(Instant::from_ticks(current_time))
}

fn symbol_duration(&self) -> Duration {
fn symbol_period(&self) -> Duration {
Duration::from_ticks(65536)
}

Expand Down
2 changes: 1 addition & 1 deletion lr-wpan-rs-tests/src/aether/radio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Phy for AetherRadio {
Ok(self.aether().simulation_time().now())
}

fn symbol_duration(&self) -> lr_wpan_rs::time::Duration {
fn symbol_period(&self) -> lr_wpan_rs::time::Duration {
lr_wpan_rs::time::Duration::from_ticks(10000)
}

Expand Down
6 changes: 3 additions & 3 deletions lr-wpan-rs/src/mac/mlme_associate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ pub async fn process_associate_request<'a>(
false,
true,
SendContinuation::WaitForResponse {
turnaround_time: phy.symbol_duration() * crate::consts::TURNAROUND_TIME as i64,
timeout: phy.symbol_duration() * ack_wait_duration,
turnaround_time: phy.symbol_period() * crate::consts::TURNAROUND_TIME as i64,
timeout: phy.symbol_period() * ack_wait_duration,
},
)
.await;
Expand Down Expand Up @@ -167,7 +167,7 @@ pub async fn process_associate_request<'a>(
mode: DataRequestMode::Independent {
timestamp: Some(
ack_timestamp
+ phy.symbol_duration()
+ phy.symbol_period()
* crate::consts::BASE_SUPERFRAME_DURATION as i64
* mac_pib.response_wait_time as i64,
),
Expand Down
2 changes: 1 addition & 1 deletion lr-wpan-rs/src/mac/mlme_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub async fn process_scan_request<'a>(
// Create the process. Making this `Some` will mark the scan as 'in process' for the rest of the system
mac_state.current_scan_process = Some(ScanProcess {
responder,
symbol_duration: phy.symbol_duration(),
symbol_duration: phy.symbol_period(),
end_time: current_time, // This waits 0 time before the first scan begins
results: ScanConfirm {
status: Status::Success,
Expand Down
14 changes: 7 additions & 7 deletions lr-wpan-rs/src/mac/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ async fn wait_for_radio_event<P: Phy>(
return RadioEvent::Error;
}
};
let symbol_duration = phy.symbol_duration();
let symbol_duration = phy.symbol_period();
let current_time_symbols = current_time / symbol_duration;

// TODO: Figure out when exactly we should put the radio in RX
Expand Down Expand Up @@ -292,7 +292,7 @@ async fn handle_radio_event<'a, P: Phy>(
}
RadioEvent::OwnSuperframeStartMissed { start_time } => {
// Reset so hopefully the next time works out
mac_pib.beacon_tx_time = start_time / phy.symbol_duration();
mac_pib.beacon_tx_time = start_time / phy.symbol_period();
}
RadioEvent::OwnSuperframeEnd => {
mac_state.own_superframe_active = false;
Expand All @@ -314,7 +314,7 @@ async fn handle_radio_event<'a, P: Phy>(
mac_pib,
mac_handler,
indirect_indications.as_mut(),
phy.symbol_duration(),
phy.symbol_period(),
)
.await
{
Expand Down Expand Up @@ -380,7 +380,7 @@ async fn send_ack(
});

// TODO: Actually schedule this according to the rules (5.1.6.4.2)
let ack_send_time = receive_time + phy.symbol_duration() * mac_pib.sifs_period as i64;
let ack_send_time = receive_time + phy.symbol_period() * mac_pib.sifs_period as i64;
trace!("Sending ack at {}", ack_send_time);

match phy
Expand Down Expand Up @@ -464,8 +464,8 @@ async fn perform_data_request(
false,
true, // TODO: Unless in superframe
SendContinuation::WaitForResponse {
turnaround_time: phy.symbol_duration() * crate::consts::TURNAROUND_TIME as i64,
timeout: phy.symbol_duration() * ack_wait_duration,
turnaround_time: phy.symbol_period() * crate::consts::TURNAROUND_TIME as i64,
timeout: phy.symbol_period() * ack_wait_duration,
},
)
.await;
Expand Down Expand Up @@ -775,7 +775,7 @@ async fn send_beacon(
}
}

mac_pib.beacon_tx_time = send_time / phy.symbol_duration();
mac_pib.beacon_tx_time = send_time / phy.symbol_period();
}

enum RadioEvent<P: Phy> {
Expand Down
2 changes: 1 addition & 1 deletion lr-wpan-rs/src/phy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait Phy {
async fn get_instant(&mut self) -> Result<Instant, Self::Error>;

/// Get the amount of time each symbol takes.
fn symbol_duration(&self) -> Duration;
fn symbol_period(&self) -> Duration;

/// Send some data.
///
Expand Down

0 comments on commit 95e4ce3

Please sign in to comment.