   }
 
   void wait_time(uint32_t microseconds) {
+    DEBUG("Waiting %d microseconds...", microseconds);
     uint32_t until = micros() + microseconds;
     while (microseconds--) {
       twiddler_.pulse_clock();

    XSIR,
    XSDR,
    XRUNTEST,
    XREPEAT = 7,
    XSDRSIZE,
    XSDRTDO,
    XSETSDRMASKS,

// Knows how to set MCU-specific pins in a JTAG-relevant way.
class Twiddler {
 public:
 Twiddler() : portb_(0) {
    DDRB = TMS | TDI | TCK;
  }

  inline void pulse_clock() {
    clr_port(TCK);
    delayMicroseconds(1);
    set_port(TCK);
  }

  bool pulse_clock_and_read_tdo() {
    clr_port(TCK);
    delayMicroseconds(1);
    uint8_t pinb = PINB;
    set_port(TCK);
    return pinb & TDO;
  }

  void wait_time(unsigned long microsec) {
