Revision 255
deleting mouse_macros.h
mouse.c | ||
---|---|---|
4 | 4 |
|
5 | 5 |
#include "errors.h" |
6 | 6 |
#include "kbc_macros.h" |
7 |
#include "mouse_macros.h" |
|
8 | 7 |
#include "kbc.h" |
9 | 8 |
|
9 |
/* Mouse Data Packet */ |
|
10 |
// Byte 0 - Button States |
|
11 |
#define LEFT_BUTTON BIT(0) /* @brief Left button click event*/ |
|
12 |
#define RIGHT_BUTTON BIT(1) /* @brief Right button click event */ |
|
13 |
#define MIDDLE_BUTTON BIT(2) /* @brief Middle button click event */ |
|
14 |
#define FIRST_BYTE_ID BIT(3) /* @brief Identifier of first byte of packet CAREFUL: Not 100% accurate */ |
|
15 |
#define MSB_X_DELTA BIT(4) /* @brief Most significant bit of X delta */ |
|
16 |
#define MSB_Y_DELTA BIT(5) /* @brief Most significant bit of Y delta */ |
|
17 |
#define X_OVERFLOW BIT(6) /* @brief X delta overflowed */ |
|
18 |
#define Y_OVERFLOW BIT(7) /* @brief Y delta overflowed */ |
|
19 |
// Byte 1 - X delta |
|
20 |
// Byte 2 - Y delta |
|
21 |
|
|
22 |
/* Mouse Commands */ |
|
23 |
#define RESET 0xFF /* @brief Reset mouse */ |
|
24 |
#define RESEND 0xFE /* @brief Resend command */ |
|
25 |
#define DEFAULT 0xF6 /* @brief Set default values */ |
|
26 |
#define DIS_DATA_REP 0xF5 /* @brief Disable Data Reporting */ |
|
27 |
#define ENABLE_DATA_REP 0xF4 /* @brief Enable Data Reporting */ |
|
28 |
#define SET_SAMPLE_RT 0xF3 /* @brief Sets state sampling rate */ |
|
29 |
#define SET_REMOTE_MD 0xF0 /* @brief Sets Mouse on Remote Mode, data on request */ |
|
30 |
#define READ_DATA 0xEB /* @brief Sends data packet request */ |
|
31 |
#define SET_STREAM_MD 0xEA /* @brief Sets mouse on Stream Mode, data on events */ |
|
32 |
#define STATUS_REQUEST 0xE9 /* @brief Get mouse configuration */ |
|
33 |
#define SET_RESOLUTION 0xE8 /* @brief Sets resolution for mouse movement */ |
|
34 |
#define SCALING_ACC_MD 0xE7 /* @brief Sets scaling on acceleration mode */ |
|
35 |
#define SCALING_LIN_MD 0xE6 /* @brief Sets scaling on linear mode */ |
|
36 |
|
|
37 |
/* Mouse Controller Responses */ |
|
38 |
#define ACK_OK 0xFA /* @brief Operation sucessful */ |
|
39 |
#define ACK_INVALID 0xFE /* @brief Invalid Byte, first occurence */ |
|
40 |
#define ACK_ERROR 0xFC /* @brief Invalid Byte on resend */ |
|
41 |
|
|
10 | 42 |
int (subscribe_mouse_interrupt)(uint8_t interrupt_bit, int *interrupt_id) { |
11 | 43 |
if (interrupt_id == NULL) return NULL_PTR; |
12 | 44 |
*interrupt_id = interrupt_bit; |
Also available in: Unified diff