pub struct Tpx3Packet(/* private fields */);Expand description
TPX3 packet wrapper providing efficient field extraction.
Packet format (64-bit):
-
Hit packets (ID 0xB*):
- Bits 0-15: SPIDR time
- Bits 16-19: Fine
ToA(4-bit) - Bits 20-29:
ToT(10-bit) - Bits 30-43:
ToA(14-bit) - Bits 44-59: Pixel address (16-bit)
- Bits 60-63: Packet type ID
-
TDC packets (ID 0x6F):
- Bits 12-41: 30-bit TDC timestamp
- Bits 56-63: Packet type ID
Implementations§
Source§impl Tpx3Packet
impl Tpx3Packet
Sourcepub const TPX3_HEADER_MAGIC: u64 = 0x3358_5054
pub const TPX3_HEADER_MAGIC: u64 = 0x3358_5054
TPX3 header magic number (“TPX3” in little-endian).
Sourcepub const fn packet_type(&self) -> u8
pub const fn packet_type(&self) -> u8
Get packet type identifier.
Sourcepub const fn pixel_address(&self) -> u16
pub const fn pixel_address(&self) -> u16
Get 16-bit pixel address from hit packet.
Sourcepub const fn spidr_time(&self) -> u16
pub const fn spidr_time(&self) -> u16
Get SPIDR time (16-bit).
Sourcepub const fn tdc_timestamp(&self) -> u32
pub const fn tdc_timestamp(&self) -> u32
Get 30-bit TDC timestamp from TDC packet.
Sourcepub const fn pixel_coordinates(&self) -> (u16, u16)
pub const fn pixel_coordinates(&self) -> (u16, u16)
Decode pixel address to local (x, y) coordinates.
- dcol = (addr >> 8) & 0xFE
- spix = (addr >> 1) & 0xFC
- pix = addr & 0x7
- x = dcol + (pix >> 2)
- y = spix + (pix & 0x3)
Source§impl Tpx3Packet
impl Tpx3Packet
Sourcepub fn from_bytes(bytes: [u8; 8]) -> Self
pub fn from_bytes(bytes: [u8; 8]) -> Self
Create from 8-byte array (little-endian).
Sourcepub const fn is_pixel_data(&self) -> bool
pub const fn is_pixel_data(&self) -> bool
Alias for is_hit - checks if this is pixel data.
Sourcepub fn timestamp_coarse(&self) -> u32
pub fn timestamp_coarse(&self) -> u32
Calculate coarse timestamp in 25ns units from SPIDR time and ToA.
Formula: (spidr_time << 14) | toa
Matches C++ reference implementation.
Trait Implementations§
Source§impl Clone for Tpx3Packet
impl Clone for Tpx3Packet
Source§fn clone(&self) -> Tpx3Packet
fn clone(&self) -> Tpx3Packet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Tpx3Packet
impl Debug for Tpx3Packet
Source§impl From<u64> for Tpx3Packet
impl From<u64> for Tpx3Packet
impl Copy for Tpx3Packet
Auto Trait Implementations§
impl Freeze for Tpx3Packet
impl RefUnwindSafe for Tpx3Packet
impl Send for Tpx3Packet
impl Sync for Tpx3Packet
impl Unpin for Tpx3Packet
impl UnwindSafe for Tpx3Packet
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