Embed:
(wiki syntax)
Show/hide line numbers
GenericMouse.c
00001 /* AbsoluteMouse.c */ 00002 00003 /* USB device example: an absolute mouse */ 00004 /* Copyright (c) 2011 ARM Limited. All rights reserved. */ 00005 00006 #include "stdint.h" 00007 00008 #include "GenericMouse.h" 00009 00010 bool GenericMouse::move(int16_t x, int16_t y) { 00011 return update(x, y, button, 0); 00012 } 00013 00014 bool GenericMouse::scroll(int8_t z) { 00015 return update(0, 0, button, z); 00016 } 00017 00018 00019 bool GenericMouse::doubleClick() { 00020 if (!click(MOUSE_LEFT)) 00021 return false; 00022 wait(0.1); 00023 return click(MOUSE_LEFT); 00024 } 00025 00026 bool GenericMouse::click(uint8_t button) { 00027 if (!update(0, 0, button, 0)) 00028 return false; 00029 wait(0.01); 00030 return update(0, 0, 0, 0); 00031 } 00032 00033 bool GenericMouse::press(uint8_t button_) { 00034 button = button_ & 0x07; 00035 return update(0, 0, button, 0); 00036 } 00037 00038 bool GenericMouse::release(uint8_t button_) { 00039 button = (button & (~button_)) & 0x07; 00040 return update(0, 0, button, 0); 00041 }
Generated on Fri Jul 15 2022 02:22:27 by 1.7.2