[][src]Struct ps2::Mouse

pub struct Mouse<'c> { /* fields omitted */ }

A PS/2 mouse.

This provides the functionality of a typical PS/2 mouse, as well as PS/2 devices that act like mice, such as touchpads or wireless mouse receivers.

Examples

use ps2::Controller;

let mut controller = unsafe { Controller::new() };
let mut mouse = controller.mouse();

Implementations

impl<'c> Mouse<'c>[src]

pub fn set_scaling_one_to_one(&mut self) -> Result<(), MouseError>[src]

Set the scaling of reported data to be 1:1.

Read more about scaling here.

pub fn set_scaling_two_to_one(&mut self) -> Result<(), MouseError>[src]

Set the scaling of reported data to be 2:1.

Read more about scaling here.

pub fn set_resolution(&mut self, resolution: u8) -> Result<(), MouseError>[src]

Set mouse resolution.

Valid values are 0 for 1 count/mm, 1 for 2 counts/mm, 2 for 4 counts/mm, or 3 for 8 counts/mm.

pub fn get_status_packet(
    &mut self
) -> Result<(MouseStatusFlags, u8, u8), MouseError>
[src]

Request a status packet from the mouse and reset the movement counters.

The first byte returned is a bitfield, the second byte is the mouse resolution, and the third is the sample rate.

pub fn set_stream_mode(&mut self) -> Result<(), MouseError>[src]

Reset mouse movement counters and enter streaming mode.

Read more about modes here.

pub fn request_data_packet(
    &mut self
) -> Result<(MouseMovementFlags, i16, i16), MouseError>
[src]

Request a movement data packet from the mouse and reset the movement counters.

The first byte returned is a bitfield, and the other two bytes are 9-bit two's complement integers for the horizontal and vertical movement offset relative to the position at which the last packet was sent.

If you're writing an interrupt handler, see Mouse::read_data_packet.

pub fn read_data_packet(
    &mut self
) -> Result<(MouseMovementFlags, i16, i16), MouseError>
[src]

Read an existing movement data packet directly from the data buffer.

The first byte returned is a bitfield, and the other two bytes are 9-bit two's complement integers for the horizontal and vertical movement offset relative to the position at which the last packet was sent.

This does not send any commands to the mouse. This is useful in interrupt handlers when we just want to read the data sent by the mouse.

pub fn reset_wrap_mode(&mut self) -> Result<(), MouseError>[src]

Reset mouse movement counters and exit wrap mode, entering the mode the mouse was in previously.

Read more about modes here.

pub fn set_wrap_mode(&mut self) -> Result<(), MouseError>[src]

Reset mouse movement counters and enter wrap mode.

Read more about modes here.

pub fn set_remote_mode(&mut self) -> Result<(), MouseError>[src]

Reset mouse movement counters and enter remote mode.

Read more about modes here.

pub fn get_mouse_type(&mut self) -> Result<MouseType, MouseError>[src]

Attempt to obtain a device identifier for this mouse.

pub fn set_sample_rate(&mut self, sample_rate: u8) -> Result<(), MouseError>[src]

Set the mouse sample rate and reset the movement counters.

Valid rates are 10, 20, 40, 60, 80, 100, and 200, in samples per second.

pub fn enable_data_reporting(&mut self) -> Result<(), MouseError>[src]

Enable data reporting and reset the movement counters.

This only affects data reporting in stream mode.

pub fn disable_data_reporting(&mut self) -> Result<(), MouseError>[src]

Disable data reporting and reset the movement counters.

This only affects data reporting in stream mode. Note that this only disables reporting, not sampling. Movement packets may still be read using Mouse::request_data_packet.

pub fn set_defaults(&mut self) -> Result<(), MouseError>[src]

Set defaults, clear movement counters, and enter stream mode.

Default settings are as follows: sampling rate = 100 samples/second, resolution = 4 counts/mm, scaling = 1:1, data reporting disabled.

pub fn resend_last_packet(&mut self) -> Result<(), MouseError>[src]

Request that the mouse resend the last transmitted byte or packet.

Currently, this does not return any data, since the resent data may be one or more bytes in length. It is the responsibility of the caller to consume these bytes using Controller::read_data.

pub fn reset_and_self_test(&mut self) -> Result<(), MouseError>[src]

Reset the mouse and perform a Basic Assurance Test.

Returns MouseError::SelfTestFailed if the test fails.

Trait Implementations

impl<'c> Debug for Mouse<'c>[src]

Auto Trait Implementations

impl<'c> Send for Mouse<'c>[src]

impl<'c> Sync for Mouse<'c>[src]

impl<'c> Unpin for Mouse<'c>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.