pub struct Scr {
pub base: u64,
pub extension: u16,
}Expand description
System Clock Reference (42-bit total: 33-bit base + 9-bit extension, in 27 MHz units).
Fields§
§base: u6433-bit SCR base (27 MHz ticks, integer part).
extension: u169-bit SCR extension (27 MHz ticks, fractional part / 300).
Implementations§
Source§impl Scr
impl Scr
Sourcepub const fn ticks(self) -> u64
pub const fn ticks(self) -> u64
The total SCR value in 27 MHz ticks.
base * 300 + extension.
Examples found in repository?
examples/parse_pack_header.rs (line 19)
9fn main() {
10 // A minimal pack header (from the fixture pattern):
11 // start_code 0x000001BA, SCR=0, mux_rate=0x10CD8E, reserved=0x1F, stuffing=0
12 let bytes = [
13 0x00, 0x00, 0x01, 0xBA, 0x44, 0x00, 0x04, 0x00, 0x04, 0x01, 0x43, 0x36, 0x3B, 0xF8,
14 ];
15 let header = PackHeader::parse(&bytes).unwrap();
16 println!("pack_start_code: 0x000001BA");
17 println!("SCR base: {}", header.scr.base);
18 println!("SCR extension: {}", header.scr.extension);
19 println!("SCR ticks: {}", header.scr.ticks());
20 println!("SCR seconds: {:.6}", header.scr.seconds());
21 println!(
22 "program_mux_rate: {} ({} B/s)",
23 header.program_mux_rate,
24 header.program_mux_rate * 50
25 );
26 println!("pack_stuffing_length: {}", header.stuffing_length);
27 println!("reserved: {}", header.reserved);
28}Sourcepub fn seconds(self) -> f64
pub fn seconds(self) -> f64
Value in seconds.
Examples found in repository?
examples/parse_pack_header.rs (line 20)
9fn main() {
10 // A minimal pack header (from the fixture pattern):
11 // start_code 0x000001BA, SCR=0, mux_rate=0x10CD8E, reserved=0x1F, stuffing=0
12 let bytes = [
13 0x00, 0x00, 0x01, 0xBA, 0x44, 0x00, 0x04, 0x00, 0x04, 0x01, 0x43, 0x36, 0x3B, 0xF8,
14 ];
15 let header = PackHeader::parse(&bytes).unwrap();
16 println!("pack_start_code: 0x000001BA");
17 println!("SCR base: {}", header.scr.base);
18 println!("SCR extension: {}", header.scr.extension);
19 println!("SCR ticks: {}", header.scr.ticks());
20 println!("SCR seconds: {:.6}", header.scr.seconds());
21 println!(
22 "program_mux_rate: {} ({} B/s)",
23 header.program_mux_rate,
24 header.program_mux_rate * 50
25 );
26 println!("pack_stuffing_length: {}", header.stuffing_length);
27 println!("reserved: {}", header.reserved);
28}Trait Implementations§
impl Copy for Scr
impl Eq for Scr
impl StructuralPartialEq for Scr
Auto Trait Implementations§
impl Forget for Scr
impl Freeze for Scr
impl RefUnwindSafe for Scr
impl Send for Scr
impl Sync for Scr
impl Unpin for Scr
impl UnsafeUnpin for Scr
impl UnwindSafe for Scr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more