public byte TPI_receivebyte_skipIDLE() { D_HIGH(); //flush(); Bitbuffer buf = receivebits(_TPIidlebits + 12); buf.discardUntil0(); int countbits = 0; while (buf.length < 12) { System.Diagnostics.Debug.Print("TPI_receivebyte_skipIDLE: Have to read more bits..."); countbits += 12 - buf.length; Bitbuffer buf2 = receivebits(12 - buf.length); for (int i = 0; i < buf2.length; i++) { buf.enqueuebit(buf2[i]); } buf.discardUntil0(); if (countbits > 128 + 2 + 50) { System.Diagnostics.Debug.Print("TPI_receivebyte_skipIDLE: Too many IDLE bits"); throw new System.Exception("Target: Too many IDLE bits. Target is not responding."); } } buf.dequeuebit(); // ST byte result = buf.dequeuebyte_LSBfirst(); //buf.dequeuebit(); // P //buf.dequeuebit(); // SP1 //buf.dequeuebit(); // SP2 return(result); }
public byte[] TPI_SLD_3bytes() { Bitbuffer rcv1 = new Bitbuffer(new byte[2], 16); Bitbuffer rcv2 = new Bitbuffer(new byte[2], 16); Bitbuffer rcv3 = new Bitbuffer(new byte[2], 16); sendNreceive(TPI_constructsendmessage(0x24), rcv1, TPI_constructsendmessage(0x24), rcv2, TPI_constructsendmessage(0x24), rcv3); _TPIaddress += 3; rcv1.discardUntil0(); if (rcv1.length < 9) { // ooops } rcv1.dequeuebit(); // ST rcv2.discardUntil0(); if (rcv2.length < 9) { // ooops } rcv2.dequeuebit(); // ST rcv3.discardUntil0(); if (rcv3.length < 9) { // ooops } rcv3.dequeuebit(); // ST return(new byte[] { rcv1.dequeuebyte_LSBfirst(), rcv2.dequeuebyte_LSBfirst(), rcv3.dequeuebyte_LSBfirst() }); }
public byte TPI_receivebyte() { D_HIGH(); //flush(); Bitbuffer buf = receivebits(12); buf.discardUntil0(); while (buf.length < 12) { Bitbuffer buf2 = receivebits(12 - buf.length); for (int i = 0; i < buf2.length; i++) { buf.enqueuebit(buf2[i]); } buf.discardUntil0(); } buf.dequeuebit(); // ST byte result = buf.dequeuebyte_LSBfirst(); //buf.dequeuebit(); // P //buf.dequeuebit(); // SP1 //buf.dequeuebit(); // SP2 return(result); }