Beispiel #1
0
unsigned long get_time_ticks(void)
{
	long clock_ticks;

#ifdef INCLUDED_FROM_KERNEL
	clock_ticks = Tick_get();
#else
	clock_ticks = clock();
#endif

	return clock_ticks;
}
Beispiel #2
0
void CTP_interrupt(void)
{
    REG_INT_FSIF01 = FSRX1 | FSERR1; // clear the interrupt

    while (0 != (REG_EFSIF1_STATUS & RDBFx)) {
        register uint32_t c = REG_EFSIF1_RXD;

        if (0xaa == c) {
            touch_state = STATE_X_HIGH;
        } else if (0 != (0x80 & c) && (0xff != c)) {
            touch_state = STATE_WAITING;
        } else {
            switch (touch_state) {
            case STATE_WAITING:
                break;
            case STATE_X_HIGH:
                if (0xff != c) {
                    x = c << 7;
                }
                ++touch_state;
                break;
            case STATE_X_LOW:
                if (0xff != c) {
                    x |= c;
                }
                ++touch_state;
                break;
            case STATE_Y_HIGH:
                if (0xff != c) {
                    y = c << 7;
                }
                ++touch_state;
                break;
            case STATE_Y_LOW:
                if (0xff != c) {
                    y |= c;
                }
                ++touch_state;
                break;
            case STATE_TOUCH:
                if (!BUFFER_FULL(CTPwrite, CTPread, CTPbuffer)) {
                    if (0x01 == c) {
                        CTPbuffer[CTPwrite].x = x;
                        CTPbuffer[CTPwrite].y = y;
                        CTPbuffer[CTPwrite].pressed = true;
                        CTPbuffer[CTPwrite].ticks = Tick_get();
                        BUFFER_NEXT(CTPwrite, CTPbuffer);
                    } else if (0x00 == c) {
                        CTPbuffer[CTPwrite].x = x;
                        CTPbuffer[CTPwrite].y = y;
                        CTPbuffer[CTPwrite].pressed = false;
                        CTPbuffer[CTPwrite].ticks = Tick_get();
                        BUFFER_NEXT(CTPwrite, CTPbuffer);
                    }
                }
                touch_state = STATE_WAITING;
                break;
            }

        }
    }
    REG_EFSIF1_STATUS = 0; // clear errors
}