Exemplo n.º 1
0
int test_config(void) {
	printf("\n\tTouch in the mouse\n\n");
	unsigned long data, res;
	unsigned char a[3];
	mouse_subscribe();
	mouse_write(MOUSE_STATUS);
	mouse_read(&data);
	while (1) {
		mouse_read(&data);
		if ((BIT(7) & data) && (BIT(3) & res))
			break;
	}
	a[0] = data;
	while (1) {
		mouse_read(&data);
		if (data <= 3)
			break;
	}
	a[1] = data;
	tickdelay(micros_to_ticks(DELAY_US));
	if (mouse_read(&data) != 0)
		return -1;
	a[2] = data;
	printf("\n\tCONFIGURATION\n");
	printf(
			"\tMode: %s\n\tEnable: %d\n\tScaling: %s\n\tLB: %d\n\tMB: %d\n\tRB: %d\n\tResolution: %d count/mm\n\tSample Rate: %d\n",
			MODE(a[0]) ? "Remote" : "Stream", ENABLE(a[0]),
			SCALING(a[0]) ? "1:1" : "2:1", LEFT(a[0]), MIDDLE(a[0]),
			RIGHT(a[0]), RESOLUTION(a[1]), RATE(a[2]));
	mouse_unsubscribe();
	printf("\n\tpress ANY KEY to continue\n");
	mouse_read(&res); /* clear out buffer */
}
Exemplo n.º 2
0
int test_config(void) {
	unsigned long byte;
	subscribe_mouse();
	mouse_write_byte(DISABLE_DATA_PACKETS);
	mouse_write_byte(STATUS_REQUEST);
	byte = mouse_read();
	if(byte == -1) return 1;
	printf("byte 1: 0x%X\n", byte);
	printf("Scaling: ");
	if(!SCALING(byte))
		printf("1:1  ");
	else
		printf("2:1  ");
	printf("Data Reporting: ");
	if(!DATA_REPORTING(byte))
		printf("disable  ");
	else
		printf("enable   ");
	printf("Mode: ");
	if(!MODE(byte))
		printf("remote mode\n\n");
	else
		printf("stream mode\n\n");
	if(LB(byte))
		printf("LB: pressed ");
	else
		printf("LB: not pressed ");
	if(RB(byte))
		printf("RB: pressed ");
	else
		printf("RB: not pressed ");
	if(MB(byte))
		printf("MB: pressed ");
	else
		printf("MB: not pressed ");
	byte = mouse_read();
	if(byte == -1) return 1;
	printf("\n byte 2: 0x%X\n", byte);
	printf("Resolution: %d\n\n", byte);
	byte = mouse_read();
	if(byte == -1) return 1;
	printf("byte 3: 0x%X\n", byte);
	printf("Sample Rate: %d\n\n", byte);
}