Struct ps2::Mouse[][src]

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

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

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

Read more about scaling here.

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

Read more about scaling here.

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.

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.

Reset mouse movement counters and enter streaming mode.

Read more about modes here.

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.

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.

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

Read more about modes here.

Reset mouse movement counters and enter wrap mode.

Read more about modes here.

Reset mouse movement counters and enter remote mode.

Read more about modes here.

Attempt to obtain a device identifier for this mouse.

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.

Enable data reporting and reset the movement counters.

This only affects data reporting in stream mode.

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.

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.

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.

Reset the mouse and perform a Basic Assurance Test.

Returns MouseError::SelfTestFailed if the test fails.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.