コード例 #1
0
ファイル: isr.c プロジェクト: stevengos/IN4073
void isr_buttons(void)
{
    char i;

    DISABLE_INTERRUPT(INTERRUPT_BUTTONS);

    for(i=0; i < 10; i++, catnap(500))

        X32_LEDS = ALL_ON, catnap(500), X32_LEDS = ALL_OFF;

    stop();
}
コード例 #2
0
/*	Close fences are matched against their partners, and if
	on screen the cursor briefly lights there		*/
void
fmatch(int rch)
{
	MARK	oldpos; 		/* original position */
	register LINE *toplp;	/* top line in current window */
	register int count; /* current fence level count */
	register char c;	/* current character in scan */
	int dir, lch;
	int backcharfailed = FALSE;

	/* get the matching left-fence char, if it exists */
	lch = is_user_fence(rch, &dir);
	if (lch == 0 || dir != REVERSE)
		return;

	/* first get the display update out there */
	(void)update(FALSE);

	/* save the original cursor position */
	oldpos = DOT;

	/* find the top line and set up for scan */
	toplp = lback(curwp->w_line.l);
	count = 1;
	backchar(TRUE, 2);

	/* scan back until we find it, or reach past the top of the window */
	while (count > 0 && DOT.l != toplp) {
		c = CurrentChar();
		if (c == rch)
			++count;
		if (c == lch)
			--count;
		if (backchar(FALSE, 1) != TRUE) {
			backcharfailed = TRUE;
			break;
		}
	}

	/* if count is zero, we have a match, display the sucker */
	if (count == 0) {
		if (!backcharfailed)
			forwchar(FALSE, 1);
		if (update(FALSE) == TRUE)
		/* the idea is to leave the cursor there for about a
			quarter of a second */
			catnap(300, FALSE);
	}

	/* restore the current position */
	DOT = oldpos;
}
コード例 #3
0
ファイル: isr.c プロジェクト: stevengos/IN4073
void isr_timer(void)
{
    if( qr.link_down )
    {
        unsigned char i;

        qr.current_mode = SAFE_MODE;
        stop_motors();
        qr.exit = 1;
        qr.flag_mode = 1;

        for(i=0; i < 5; i++, catnap(500))
            X32_LEDS = ALL_ON, catnap(500), X32_LEDS = ALL_OFF;

        #ifdef PERIPHERAL_DISPLAY
            X32_DISPLAY = 0xf1fa;
        #endif

        DISABLE_INTERRUPT(INTERRUPT_TIMER1);
    }

    qr.link_down = 1;
}
コード例 #4
0
ファイル: npopen.c プロジェクト: ricksladkey/vile
int
softfork(void)
{
    /* Try & fork 5 times, backing off 1, 2, 4 .. seconds each try */
    int fpid;
    int tries = 5;
    int slp = 1;

    while ((fpid = fork()) < 0) {
        if (--tries == 0)
            return -1;
        (void) catnap(slp * 1000, FALSE);
        slp <<= 1;
    }
    pipe_pid2 = fpid;		/* For calls to softfork which don't
				   remember the pid */
    return fpid;
}