- for(int i=7; i>=0; i--) {
- d.config((((in & 0xff) & (1<<i))!=0)?1:0, 1);
- boolean init = true; // d.initErr()
- if (bytes < 100 || (bytes % 1000)==0) {
- d.flush();
- init = d.initErr();
- System.out.print("wrote " + bytes + " bytes, init="+init+" \r");
- d.rcon();
- }
- if (!init)
- throw new RuntimeException("initialization failed at byte " + bytes + ", bit " + i);
- }
- }
-
-
- d.flush();
- if (!d.initErr())
- throw new RuntimeException("initialization failed at " + bytes);
- //System.out.println("cts="+""+" pins=" + pad(Integer.toString(d.readPins()&0xff,2),8));
-
-
- for(int i=0; i<100; i++) {
- d.flush();
- if (!d.initErr())
- throw new RuntimeException("initialization failed at " + bytes);
- try { Thread.sleep(20); } catch (Exception e) { }
- d.config(0,1);
+ os.write((byte)Integer.parseInt(s, 2));
+ if ((bytes % 1000)==0) os.flush();