Beispiel #1
0
void pulse(unsigned char t)
{
	if (t > 0)
	{
		set_h(hi);
		set_l(lo);
		OCR2B = t-1;
		TCNT2 = 0xFF;
		TCCR2A = (1 << COM2B1) | (0 << COM2B0) | (1 << WGM21) | (1 << WGM20);
		TCCR2B = (0 << WGM22) | 0x02;
		//i2c[1] = t;
	}
}
Beispiel #2
0
off_t boro_set_left_p(boro_t *b, off_t i, struct boro_node *ni, off_t p)
{
    struct boro_node *np;

    np = boro_node(b, p);

    if (np && np->c > (ni->c / 2) + 1) {
        np->n++;
        set_l(b, ni, np->r);
        set_r(b, np, i);
        np->n--;

        b->flush(b, p, np);

        i = p;
    }
    else
        set_l(b, ni, p);

    boro_node_d(b, np);

    return i;
}
Beispiel #3
0
void switch_phase(void)
{
	switch(phase)
	{
	case 0:
		sense = 0xC2;
		ACSR = (ACSR & ~0x03) | 0x03;
		clr_h(0x04);
		set_h(0x01);
		hi = 0x01;
		lo = 0x02;
		phase = 1;
		break;
	case 1:
		sense = 0xC1;
		ACSR = (ACSR & ~0x03) | 0x02;
		clr_l(0x02);
		set_l(0x04);
		hi = 0x01;
		lo = 0x04;
		phase = 2;
		break;
	case 2:
		sense = 0xC0;
		ACSR = (ACSR & ~0x03) | 0x03;
		clr_h(0x01);
		set_h(0x02);
		hi = 0x02;
		lo = 0x04;
		phase = 3;
		break;
	case 3:
		sense = 0xC2;
		ACSR = (ACSR & ~0x03) | 0x02;
		clr_l(0x04);
		set_l(0x01);
		hi = 0x02;
		lo = 0x01;
		phase = 4;
		break;
	case 4:
		sense = 0xC1;
		ACSR = (ACSR & ~0x03) | 0x03;
		clr_h(0x02);
		set_h(0x04);
		hi = 0x04;
		lo = 0x01;
		phase = 5;
		break;
	case 5:
		sense = 0xC0;
		ACSR = (ACSR & ~0x03) | 0x02;
		clr_l(0x01);
		set_l(0x02);
		hi = 0x04;
		lo = 0x02;
		phase = 0;
		break;
	default:
		break;
	}
	//i2c[2] = phase;
}