Revision 58
more changes
mouse.h | ||
---|---|---|
1 |
#ifndef _MOUSE_H_ |
|
2 |
#define _MOUSE_H_ |
|
1 |
#ifndef _MOUSE_FUNC_H_
|
|
2 |
#define _MOUSE_FUNC_H_
|
|
3 | 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 |
|
4 |
#include <stdint.h> |
|
16 | 5 |
|
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 */ |
|
6 |
/** |
|
7 |
* @brief Subscribes Mouse Interrupts and disables Minix Default IH |
|
8 |
* @param interrupt_bit Bit of Interrupt Vector that will be set when Mouse Interrupt is pending |
|
9 |
* @param interrupt_id Mouse Interrupt ID to specify the Mouse Interrupt in other calls |
|
10 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK |
|
11 |
* @see {_ERRORS_H_::errors} |
|
12 |
*/ |
|
13 |
int (subscribe_mouse_interrupt)(uint8_t interrupt_bit, int *interrupt_id); |
|
31 | 14 |
|
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 */ |
|
15 |
struct packet (mouse_parse_packet)(const uint8_t *packet_bytes); |
|
36 | 16 |
|
37 |
#endif // _MOUSE_H_ |
|
17 |
int (mouse_set_data_report)(int on); |
|
18 |
|
|
19 |
#endif /* end of include guard: _MOUSE_FUNC_H_ */ |
Also available in: Unified diff