Point touch_calculatePoint() {
	 Point p1;

	 int i;
	 for(i = 0; i < 4; i++) {
		 output[i] = serialGetChar(TOUCHSCREEN);
	 }

	 int xVal = output[0];
	 int xExtension = output[1];
	 int yVal = output[2];
	 int yExtension = output[3];

	 xVal = xVal | (xExtension << 7);
	 yVal = yVal | (yExtension << 7);

	 p1.x = ((float)(xVal - 58) / 4037.0) * 800;
	 p1.y = ((float)(yVal - 266) / 3670.0) * 480;

	 if (prevPoint.x != p1.x && prevPoint.y != p1.y) {
		 if (p1.x > 0 && p1.x < 800 && p1.y > 0 && p1.y < 480) {
			 prevPoint.x = p1.x;
			 prevPoint.y = p1.y;
			 TOUCH_DEBOUNCE = 1;

			 return p1;
		 }
	 }

	 return dumbPoint;
}
Beispiel #2
0
int main()
{
	screenInit();

	screenPutString("BIOS Terminal v1.0 build " BUILD "\r\n(C) Copyright 2004 Wojtek Kaniewski <*****@*****.**>\r\nPress F12 to configure serial port\r\n\r\n");

	serialSetup();

	for (;;) {

#ifdef DEBUG_SERIAL
		byte x, y, a;

		x = screenX; y = screenY; a = screenAttr;
		screenX = 30; screenY = 24; screenAttr = 7*16;
		screenCursorNoUpdate = 1;
		screenPutString(" s:");
		screenPutHex((char)((char) serialRxHead - (char) serialRxTail));
		screenPutString(" i:");
		screenPutHex(portRead(0x21));
		screenPutString(" t:");
		screenPutHex(serialRxTail >> 8);
		screenPutHex(serialRxTail &255);
		screenPutString("/h:");
		screenPutHex(serialRxHead >> 8);
		screenPutHex(serialRxHead &255);
		screenPutString(",");
		screenPutHex(portRead(serialPort+1));
		screenPutString(",");
		screenPutHex(serialInterruptLast); // +2
		screenPutString(",");
		screenPutHex(portRead(serialPort+3));
		screenPutString(",");
		screenPutHex(portRead(serialPort+4));
		screenPutString(",");
		screenPutHex(portRead(serialPort+5));
		screenPutString(",");
		screenPutHex(portRead(serialPort+6));
		screenPutString(" k:");
		screenCursorNoUpdate = 0;
		screenX = x; screenY = y; screenAttr = a;

		screenCursorUpdate();
#endif // DEBUG_SERIAL

		if (keyboardPressed()) {
			char *seq = vtGetChar();

			while (*seq) {
				serialPutChar(*seq);
				seq++;
			}
		}

		while (serialDataReady()) {
			char ch = serialGetChar();

			vtPutChar(ch);
		}
	}
}