123 tx_cmd = val; |
119 tx_cmd = val; |
124 tx_ack = false; |
120 tx_ack = false; |
125 tx_len = 0xFF; |
121 tx_len = 0xFF; |
126 } |
122 } |
127 else if (tx_len == 0xFF) { |
123 else if (tx_len == 0xFF) { |
128 // got a cmd, expect a payload size |
124 if (val == 0x55) { |
129 tx_len = val; |
125 // packet was in fact a keystroke, tx_cmd is in fact the key |
130 tx_ack = false; |
126 // stroke and no payload is expected |
|
127 #ifdef DEBUG2 |
|
128 statetx = 1; |
|
129 #endif |
|
130 pushCmd((TrState)Tx, tx_cmd, 0, (char*)buf); |
|
131 #ifdef DEBUG2 |
|
132 wait_us(2); |
|
133 statetx = 0; |
|
134 #endif |
|
135 reset(); |
|
136 } else { |
|
137 // got a cmd, expect a payload size |
|
138 tx_len = val; |
|
139 tx_ack = false; |
|
140 } |
131 } |
141 } |
132 else if (tx_len == 0x55) { |
142 else if (tx_len == 0x55) { |
133 // packet was in fact a keystroke, tx_cmd is in fact the key |
143 // packet was in fact a keystroke, tx_cmd is in fact the key |
134 // stroke and no payload is expected |
144 // stroke and no payload is expected |
135 pushCmd((TrState)Tx, tx_cmd, 0, NULL); |
145 #ifdef DEBUG2 |
|
146 statetx = 1; |
|
147 #endif |
|
148 pushCmd((TrState)Tx, tx_cmd, 0, (char*)buf); |
|
149 #ifdef DEBUG2 |
|
150 wait_us(2); |
|
151 statetx = 0; |
|
152 #endif |
136 reset(); |
153 reset(); |
137 } |
154 } |
138 else if (tx_len > 0) { |
155 else if (tx_len > 0) { |
139 // a payload char |
156 // a payload char |
140 buf[head++] = val; |
157 buf[head++] = val; |