root / lab4 / mouse_macros.h @ 265
History | View | Annotate | Download (1.91 KB)
1 |
#ifndef MOUSE_MACROS_H_INCLUDED
|
---|---|
2 |
#define MOUSE_MACROS_H_INCLUDED
|
3 |
|
4 |
/* Mouse Data Packet */
|
5 |
// Byte 0 - Button States
|
6 |
#define LEFT_BUTTON BIT(0) /* @brief Left button click event*/ |
7 |
#define RIGHT_BUTTON BIT(1) /* @brief Right button click event */ |
8 |
#define MIDDLE_BUTTON BIT(2) /* @brief Middle button click event */ |
9 |
#define FIRST_BYTE_ID BIT(3) /* @brief Identifier of first byte of packet CAREFUL: Not 100% accurate */ |
10 |
#define MSB_X_DELTA BIT(4) /* @brief Most significant bit of X delta */ |
11 |
#define MSB_Y_DELTA BIT(5) /* @brief Most significant bit of Y delta */ |
12 |
#define X_OVERFLOW BIT(6) /* @brief X delta overflowed */ |
13 |
#define Y_OVERFLOW BIT(7) /* @brief Y delta overflowed */ |
14 |
// Byte 1 - X delta
|
15 |
// Byte 2 - Y delta
|
16 |
|
17 |
/* Mouse Commands */
|
18 |
#define RESET 0xFF /* @brief Reset mouse */ |
19 |
#define RESEND 0xFE /* @brief Resend command */ |
20 |
#define DEFAULT 0xF6 /* @brief Set default values */ |
21 |
#define DIS_DATA_REP 0xF5 /* @brief Disable Data Reporting */ |
22 |
#define ENABLE_DATA_REP 0xF4 /* @brief Enable Data Reporting */ |
23 |
#define SET_SAMPLE_RT 0xF3 /* @brief Sets state sampling rate */ |
24 |
#define SET_REMOTE_MD 0xF0 /* @brief Sets Mouse on Remote Mode, data on request */ |
25 |
#define READ_DATA 0xEB /* @brief Sends data packet request */ |
26 |
#define SET_STREAM_MD 0xEA /* @brief Sets mouse on Stream Mode, data on events */ |
27 |
#define STATUS_REQUEST 0xE9 /* @brief Get mouse configuration */ |
28 |
#define SET_RESOLUTION 0xE8 /* @brief Sets resolution for mouse movement */ |
29 |
#define SCALING_ACC_MD 0xE7 /* @brief Sets scaling on acceleration mode */ |
30 |
#define SCALING_LIN_MD 0xE6 /* @brief Sets scaling on linear mode */ |
31 |
|
32 |
/* Mouse Controller Responses */
|
33 |
#define ACK_OK 0xFA /* @brief Operation sucessful */ |
34 |
#define ACK_INVALID 0xFE /* @brief Invalid Byte, first occurence */ |
35 |
#define ACK_ERROR 0xFC /* @brief Invalid Byte on resend */ |
36 |
|
37 |
#endif // MOUSE_MACROS_H_INCLUDED |