Project

General

Profile

Revision 80

reorganized remote

View differences:

lab4.c
35 35
  return 0;
36 36
}
37 37

  
38
extern uint8_t packet[3];
39
extern int counter;
40

  
41 38
int (mouse_test_packet)(uint32_t cnt) {
42 39
    int ret = 0;
43 40
    /// loop stuff
......
65 62
                case HARDWARE: /* hardware interrupt notification */
66 63
                    if (msg.m_notify.interrupts & mouse_irq) { /* subscribed interrupt */
67 64
                        mouse_ih();
68
                        if(counter >= 3){
69
                            struct packet pp = mouse_parse_packet(packet);
65
                        if(counter_mouse_ih >= 3){
66
                            struct packet pp = mouse_parse_packet(packet_mouse_ih);
70 67
                            mouse_print_packet(&pp);
71 68
                            cnt_now++;
72 69
                            if(cnt == cnt_now) good = 0;
......
86 83
}
87 84

  
88 85
int (mouse_test_remote)(uint16_t period, uint8_t cnt) {
89

  
90
    // Mouse packets data
91
    uint8_t packet[3];
92
    int sz = 0;
93
    uint8_t data = 0;
94
    // Cycle
95
    int packetCounter = 0;
96
    int good = 1;
97
    // return value
98 86
    int ret;
87
    //if ((ret = mouse_issue_cmd(SET_REMOTE_MD))) return ret;
88
    //if ((ret = mouse_set_data_report(true))) return ret;
99 89

  
100
    if ((ret = mouse_issue_cmd(SET_REMOTE_MD))) return ret;
101

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

  
90
    struct packet pp;
91
    while(cnt--){
92
        if(mouse_poll(&pp, period)) return 1;
93
        mouse_print_packet(&pp);
94
    }
95
    /*
104 96
    while (good) {
105 97

  
106 98
        if ((ret = mouse_read_data(&data))) return ret;
......
118 110
        }
119 111
        tickdelay(micros_to_ticks(period*1e3));
120 112
    }
121

  
113
    */
122 114
    // Set Stream mode
123 115
    if ((ret = mouse_issue_cmd(SET_STREAM_MD))) return ret;
124 116
    // Disable data reporting
......
167 159
                    }
168 160
                    if (msg.m_notify.interrupts & mouse_irq) { /// subscribed interrupt
169 161
                        mouse_ih();
170
                        if(counter >= 3){
171
                            struct packet pp = mouse_parse_packet(packet);
162
                        if(counter_mouse_ih >= 3){
163
                            struct packet pp = mouse_parse_packet(packet_mouse_ih);
172 164
                            mouse_print_packet(&pp);
173 165
                            time = 0;
174 166
                            no_interrupts = 0;
......
221 213
                case HARDWARE: /* hardware interrupt notification */
222 214
                    if (msg.m_notify.interrupts & mouse_irq) { /* subscribed interrupt */
223 215
                        mouse_ih();
224
                        if(counter >= 3) {
225
                            pp = mouse_parse_packet(packet);
216
                        if(counter_mouse_ih >= 3) {
217
                            pp = mouse_parse_packet(packet_mouse_ih);
226 218
                            mouse_print_packet(&pp);
227 219
                            event = mouse_get_event(&pp);
228 220

  

Also available in: Unified diff