@@ -74,9 +74,11 @@ uint8_t ID_Logitech[2][8] = {
74
74
{ 0x0D , 0x4D , 0x33 , 0x08 , 0x01 , 0x24 , 0x2C , 0x27 },
75
75
{ 0x29 , 0x18 , 0x10 , 0x10 , 0x11 , 0x09 , 0x00 , 0x00 } };
76
76
77
+ //{ 0x52, 0x4D, 0x5A, 0x40, 0x00, 0x00, 0x00, 0x08 },
78
+
77
79
// MS Wheel mouse 'MZ@' + PNP
78
80
uint8_t ID_Wheelmouse [11 ][8 ] = {
79
- { 0x52 , 0x4D , 0x5A , 0x40 , 0x00 , 0x00 , 0x00 , 0x08 },
81
+ { 0x52 , 0x4D , 0x5A , 0x40 , 0x00 , 0x00 , 0x00 , 0x00 },
80
82
{ 0x01 , 0x24 , 0x2D , 0x33 , 0x28 , 0x10 , 0x10 , 0x10 },
81
83
{ 0x11 , 0x3C , 0x10 , 0x10 , 0x10 , 0x14 , 0x10 , 0x12 },
82
84
{ 0x10 , 0x10 , 0x3C , 0x2D , 0x2F , 0x35 , 0x33 , 0x25 },
@@ -95,7 +97,7 @@ void serial_putc(uint8_t *buffer, int size){
95
97
}
96
98
}
97
99
98
- void serialMouseNego () {
100
+ void serialMouseNego_old () {
99
101
100
102
/*---------------------------------------*/
101
103
// Serial Mouse negotiation //
@@ -130,7 +132,7 @@ void serialMouseNego() {
130
132
// Set Serial data bits to 8 for the pnp info
131
133
set_serial_data (8 );
132
134
133
- for ( uint8_t i = 0 ; i < 10 ; i ++ )
135
+ for ( uint8_t i = 0 ; i < 1 ; i ++ )
134
136
{
135
137
for ( uint8_t j = 0 ; j < 8 ; j ++ ) {
136
138
uart_putc_raw ( UART_ID , ID_Wheelmouse [i ][j ] );
@@ -141,7 +143,7 @@ void serialMouseNego() {
141
143
}
142
144
143
145
// Send the last 4 characters
144
- for ( uint8_t i = 0 ; i < 4 ; i ++ ) { uart_putc_raw ( UART_ID , ID_Wheelmouse [10 ][i ] ); }
146
+ // for( uint8_t i=0; i < 4; i++ ) { uart_putc_raw( UART_ID, ID_Wheelmouse[10][i] ); }
145
147
146
148
// Set back to 7 bits for mouse movement
147
149
set_serial_data (7 );
@@ -152,13 +154,62 @@ void serialMouseNego() {
152
154
sleep_us (mouse_data .serialdelay_1B );
153
155
}
154
156
157
+
158
+ void serialMouseNego () {
159
+
160
+ /*---------------------------------------*/
161
+ // Serial Mouse negotiation //
162
+ /*---------------------------------------*/
163
+ // Byte1:Always M //
164
+ // Byte2:[None]=MS 3=Logitech Z=MSWheel //
165
+ /*---------------------------------------*/
166
+
167
+ // Wait for UART to be writable
168
+ while ( !uart_is_writable (UART_ID ) ) { tight_loop_contents (); }
169
+
170
+ switch ( mouse_data .persistent .mousetype ) {
171
+ // Basic MS Mouse
172
+ case TWOBTN :
173
+ serial_putc ( "\x01\x4D\x00\x00\x00\x00\x00\x00" , 7 );
174
+
175
+ break ;
176
+
177
+ // Logitech mouse 'M3' + PNP
178
+ case THREEBTN :
179
+ serial_putc ( "\x0D\x4D\x33\x08\x01\x24\x2C\x27" , 7 );
180
+ serial_putc ( "\x29\x18\x10\x10\x11\x09\x00\x00" , 7 );
181
+
182
+ break ;
183
+
184
+ // MS Wheel mouse 'MZ@' + PNP
185
+ case WHEELBTN :
186
+ serial_putc ("\x52\x4D\x5A\x40\x00\x00\x00\x00" , 7 );
187
+ //serial_putc("\x01\x24\x2D\x33\x28\x10\x10\x10", 7);
188
+ //serial_putc("\x11\x3C\x10\x10\x10\x14\x10\x12", 7);
189
+ //serial_putc("\x10\x10\x3C\x2D\x2F\x35\x33\x25", 7);
190
+ //serial_putc("\x3C\x30\x2E\x30\x10\x26\x10\x21", 7);
191
+ //serial_putc("\x3C\x2D\x29\x23\x32\x2F\x33\x2F", 7);
192
+ //serial_putc("\x26\x34\x00\x29\x2E\x34\x25\x2C", 7);
193
+ //serial_putc("\x2C\x29\x2D\x2F\x35\x33\x25\x00", 7);
194
+ //serial_putc("\x0D\x00\x33\x25\x32\x29\x21\x2C", 7);
195
+ //serial_putc("\x00\x36\x25\x32\x33\x29\x2F\x2E", 7);
196
+ //serial_putc("\x15\x16\x09\x00\x00\x00\x00\x00", 7);
197
+
198
+ break ;
199
+ }
200
+
201
+ busy_wait_us (mouse_data .serialdelay_1B );
202
+ }
203
+
155
204
void printfMousePacket () {
156
205
printf ("Mouse: (%d %d %d)" , mouse_data .mpkt .x , mouse_data .mpkt .y , mouse_data .mpkt .wheel );
206
+ fflush (stdout );
157
207
158
208
printf (" %c%c%c\n" ,
159
209
mouse_data .mpkt .left ? 'L' : '-' ,
160
210
mouse_data .mpkt .middle ? 'M' : '-' ,
161
211
mouse_data .mpkt .right ? 'R' : '-' );
212
+ fflush (stdout );
162
213
163
214
return ;
164
215
}
0 commit comments