17 #include "simpletools.h" 19 long pulse_in(
int pin,
int state)
29 int ctr = ((8 + ((!state & 1) * 4)) << 26) + pin;
33 while((get_state(pin) == state) && (CNT - t < tf));
39 while((PHSA == 0) && (CNT - t < tf));
40 while((get_state(pin) == state) && (CNT - t < tf));
42 tPulse = PHSA/st_iodt;
49 while((PHSB == 0) && (CNT - t < tf));
50 while((get_state(pin) == state) && (CNT - t < tf));
52 tPulse = PHSB/st_iodt;