Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ps2_mouse.h 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. Copyright 2011 Jun Wako <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef PS2_MOUSE_H
  15. #define PS2_MOUSE_H
  16. #include <stdbool.h>
  17. #define PS2_MOUSE_READ_DATA 0xEB
  18. /*
  19. * Data format:
  20. * byte|7 6 5 4 3 2 1 0
  21. * ----+--------------------------------------------------------------
  22. * 0|Yovflw Xovflw Ysign Xsign 1 Middle Right Left
  23. * 1| X movement(0-255)
  24. * 2| Y movement(0-255)
  25. */
  26. #define PS2_MOUSE_BTN_MASK 0x07
  27. #define PS2_MOUSE_BTN_LEFT 0
  28. #define PS2_MOUSE_BTN_RIGHT 1
  29. #define PS2_MOUSE_BTN_MIDDLE 2
  30. #define PS2_MOUSE_X_SIGN 4
  31. #define PS2_MOUSE_Y_SIGN 5
  32. #define PS2_MOUSE_X_OVFLW 6
  33. #define PS2_MOUSE_Y_OVFLW 7
  34. uint8_t ps2_mouse_init(void);
  35. void ps2_mouse_task(void);
  36. #endif