Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Library to manage a PS2 mouse

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

rust-osdev/ps2-mouse

Repository files navigation

Build StatusDocs.rs Badge

ps2 mouse

This crate provides a basic interface for interacting with a ps2 mouse.

Basic Example

use ps2_mouse::{Mouse,MouseState};use spinning_top::Spinlock;use x86_64::instructions::port::PortReadOnly;pubstaticMOUSE:Lazy<Spinlock<Mouse>> =Lazy::new(||Spinlock::new(Mouse::new()));// Initialize the mouse and set the on complete event.fninit_mouse(){MOUSE.lock().init().unwrap();MOUSE.lock().set_on_complete(on_complete);}// This will be fired when a packet is finished being processed.fnon_complete(mouse_state:MouseState){println!("{:?}", mouse_state);}// An example interrupt based on https://os.phil-opp.com/hardware-interrupts/. The ps2 mouse is configured to fire// interrupts at PIC offset 12.extern"x86-interrupt"fnmouse_interrupt_handler(_stack_frame:&mutInterruptStackFrame){letmut port =PortReadOnly::new(0x60);let packet =unsafe{ port.read()};MOUSE.lock().process_packet(packet);unsafe{PICS.lock().notify_end_of_interrupt(InterruptIndex::Mouse.into());}}

About

Library to manage a PS2 mouse

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp