Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PS2Mouse.h
00001 /** 00002 * PS/2 mouse interface control class (Version 0.0.1) 00003 * 00004 * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems) 00005 * http://shinta.main.jp/ 00006 */ 00007 #ifndef _PS2_MOUSE_H_ 00008 #define _PS2_MOUSE_H_ 00009 00010 #include "PS2MS_INIT.h" 00011 #include "PS2MS.h" 00012 00013 class PS2Mouse { 00014 public: 00015 PS2Mouse(PinName clk_pin, PinName dat_pin); 00016 ~PS2Mouse(); 00017 typedef struct { 00018 bool left; 00019 bool center; 00020 bool right; 00021 int x; 00022 int y; 00023 int z; 00024 } mouse_event_t; 00025 bool processing(mouse_event_t *p); 00026 private: 00027 PS2MS_INIT ps2ms_init; 00028 PS2MS ps2ms; 00029 typedef struct { 00030 union { 00031 uint8_t byte; 00032 struct { 00033 uint8_t btnLeft:1; 00034 uint8_t btnRight:1; 00035 uint8_t btnCenter:1; 00036 uint8_t always1:1; 00037 uint8_t signX:1; 00038 uint8_t signY:1; 00039 uint8_t overflowX:1; 00040 uint8_t overflowY:1; 00041 } bit; 00042 } byte1; 00043 union { 00044 uint8_t byte; 00045 } byte2; 00046 union { 00047 uint8_t byte; 00048 } byte3; 00049 union { 00050 uint8_t byte; 00051 struct { 00052 uint8_t value:7; 00053 uint8_t signZ:1; 00054 } bit; 00055 } byte4; 00056 } mouse_info_t; 00057 mouse_info_t mi; 00058 int cnt; 00059 }; 00060 00061 #endif
Generated on Wed Jul 13 2022 15:37:35 by
1.7.2