pub trait CrankStateSource {
    // Required methods
    fn crank_angle_deg(&self) -> f32;
    fn crank_change_deg(&self) -> f32;
    fn is_crank_docked(&self) -> bool;

    // Provided methods
    fn crank_angle_rad(&self) -> f32 { ... }
    fn crank_change_rad(&self) -> f32 { ... }
}
Expand description

A source of the crank state

It is notably implemented for for the type ffi::playdate_sys and ffi::PlaydateAPI of the crate playdate-sys (require the feature flag playdate-sys-v02)

Required Methods§

source

fn crank_angle_deg(&self) -> f32

Returns the current position of the crank, in degrees (range from 0 to 360).

Zero is pointing up, and the value increases as the crank moves clockwise, as viewed from the right side of the device.

source

fn crank_change_deg(&self) -> f32

Returns the angle change (in degrees) of the crank since the last time this function was called.

Negative values are anti-clockwise.

source

fn is_crank_docked(&self) -> bool

Returns whether or not the crank is folded into the unit.

Provided Methods§

source

fn crank_angle_rad(&self) -> f32

Returns the current position of the crank, in the radians (range from 0 to 2 * f32::consts::PI).

Zero is pointing up, and the value increases as the crank moves clockwise, as viewed from the right side of the device.

source

fn crank_change_rad(&self) -> f32

Returns the angle change (in radians) of the crank since the last time this function was called.

Negative values are anti-clockwise.

Implementors§