Project

General

Profile

Revision 79

fully implemented state_machine & gesture

View differences:

lab4.c
101 101

  
102 102
    if ((ret = mouse_set_data_report(true))) return ret;
103 103

  
104
    uint8_t cmd = 0;
105
    if ((ret = kbc_read_cmd(&cmd))) return ret;
106

  
107 104
    while (good) {
108 105

  
109 106
        if ((ret = mouse_read_data(&data))) return ret;
......
195 192
}
196 193

  
197 194
int (mouse_test_gesture)(uint8_t x_len, uint8_t tolerance) {
195
    int ret;
198 196
    /// loop stuff
199 197
    int ipc_status, r;
200 198
    message msg;
......
202 200
    uint8_t mouse_irq_bit = 12;
203 201
    int mouse_id = 0;
204 202
    int mouse_irq = BIT(mouse_irq_bit);
205
    //if ((ret = mouse_set_data_report(true))) return ret;
206
    if (mouse_enable_data_reporting()) return 1;
203
    if ((ret = mouse_set_data_report(true))) return ret;
207 204

  
208 205
    if (subscribe_mouse_interrupt(mouse_irq_bit, &mouse_id)) return 1;
209 206
    /// cycle
......
213 210
    struct mouse_ev *event;
214 211
    struct packet pp;
215 212
    int response;
216

  
217 213
    while (good) {
218 214
        /* Get a request message. */
219 215
        if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
......
227 223
                        mouse_ih();
228 224
                        if(counter >= 3) {
229 225
                            pp = mouse_parse_packet(packet);
230
                            //mouse_print_packet(&pp);
226
                            mouse_print_packet(&pp);
231 227
                            event = mouse_get_event(&pp);
232 228

  
233 229
                            response = state_machine(event, x_len, tolerance);

Also available in: Unified diff