root / lab4 / mouse.h @ 75
History | View | Annotate | Download (2.16 KB)
1 |
#ifndef MOUSE_H_INCLUDED
|
---|---|
2 |
#define MOUSE_H_INCLUDED
|
3 |
|
4 |
#include <stdint.h> |
5 |
|
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); |
14 |
|
15 |
struct packet (mouse_parse_packet)(const uint8_t *packet_bytes); |
16 |
|
17 |
int (mouse_set_data_report)(int on); |
18 |
|
19 |
/**
|
20 |
* @brief Reads data byte from mouse
|
21 |
* <summary>
|
22 |
* Polls the mouse till data is available for reading
|
23 |
* </summary>
|
24 |
* @param data Pointer to variable where byte read from mouse will be stored
|
25 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
26 |
* @see {_ERRORS_H_::errors}
|
27 |
*/
|
28 |
int (mouse_read_data)(uint8_t *data);
|
29 |
|
30 |
/**
|
31 |
* @brief Issues command to mouse
|
32 |
* <summary>
|
33 |
* Issues command to mouse, returns error after two consecutive errors reported by the acknowledgment byte
|
34 |
* </summary>
|
35 |
* @param cmd Command to be issued
|
36 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
37 |
* @see {_ERRORS_H_::errors}
|
38 |
*/
|
39 |
int (mouse_issue_cmd)(uint32_t cmd);
|
40 |
|
41 |
/**
|
42 |
* @brief Reads byte from mouse
|
43 |
* <summary>
|
44 |
* Reads byte from mouse, giving error if exceeds number of tries to read
|
45 |
* </summary>
|
46 |
* @param byte Pointer to variable where byte read from mouse will be stored
|
47 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
48 |
* @see {_ERRORS_H_::errors}
|
49 |
*/
|
50 |
int (mouse_read_byte)(uint8_t *byte);
|
51 |
|
52 |
/**
|
53 |
* @brief Converts 9-bit number to 16-bit with sign extension
|
54 |
* @param sign_bit Sign bit identifiying the signal of the number
|
55 |
* @param byte Least significant byte that will be extended
|
56 |
* @return Extended 9-bit number
|
57 |
*/
|
58 |
int16_t (sign_extend_byte)(uint8_t sign_bit, uint8_t byte); |
59 |
|
60 |
#endif //MOUSE_H_INCLUDED |