Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

RawPoll

Struct RawPoll 

Source
pub struct RawPoll {
    pub id_low: u8,
    pub id_high: u8,
    pub buttons_low: u8,
    pub buttons_high: u8,
    pub sticks: AnalogSticks,
    pub mode: PadMode,
    pub ack_seen: u16,
    pub exchanges: u8,
}
Expand description

Raw wire result of one poll, before active-low button inversion. Carries the per-byte /ACK observations so a diagnostic can show whether the controller acknowledges each byte, and which pacing produced a clean handshake.

Fields§

§id_low: u8

ID low byte: 0x41 digital, 0x73 analog, 0xF3 config, 0xFF none.

§id_high: u8

ID high byte; 0x5A on a valid controller, anything else is a desync.

§buttons_low: u8

First button byte, raw active-low wire value.

§buttons_high: u8

Second button byte, raw active-low wire value.

§sticks: AnalogSticks

Raw stick bytes (centre 0x80) when the controller reports them.

§mode: PadMode

Mode inferred from the ID bytes (Unknown when the 0x5A magic is wrong).

§ack_seen: u16

Bit i set if exchange i observed an /ACK pulse (bit 0 = select byte).

§exchanges: u8

Number of exchanges performed (select byte + payload bytes).

Implementations§

Source§

impl RawPoll

Source

pub const NONE: Self

A poll where nothing answered (id_low 0xFF). Useful as a const seed.

Source

pub fn is_fully_acknowledged(self) -> bool

true when every payload exchange that should have been acknowledged was. The select byte (bit 0) and all bytes up to (but not including) the final, never-acknowledged byte must each show an /ACK.

Source

pub fn to_state(self) -> PadState

Convert to the cleaned PadState used by game code.

Trait Implementations§

Source§

impl Clone for RawPoll

Source§

fn clone(&self) -> RawPoll

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RawPoll

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RawPoll

Source§

fn eq(&self, other: &RawPoll) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for RawPoll

Source§

impl Eq for RawPoll

Source§

impl StructuralPartialEq for RawPoll

Auto Trait Implementations§

§

impl Freeze for RawPoll

§

impl RefUnwindSafe for RawPoll

§

impl Send for RawPoll

§

impl Sync for RawPoll

§

impl Unpin for RawPoll

§

impl UnsafeUnpin for RawPoll

§

impl UnwindSafe for RawPoll

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.