   Returned value is 2s complemented 16 bit integer.
   */
 int16_t read_analog(uint8_t next_chan) {
-  // we really don't need any interrupts messing the timings in here up
-  noInterrupts();
 
   // select the channel for the next read
   digitalWrite(_A0, next_chan&0x1?HIGH:LOW);
   digitalWrite(_A1, next_chan&0x2?HIGH:LOW);
 
+  // we really don't need any interrupts messing the timings in here up
+  noInterrupts();
+  
   // begin a conversion
   digitalWrite(_RC, LOW);
   delayMicroseconds(1);
   digitalWrite(_RC, HIGH);
 
+  interrupts();
+
   // wait for busy to go high
   wait_busy();
 


  wait_busy();

  Serial.begin(115200);
  Serial.println("Ready");
}

/**

 
}

uint8_t trigstate = LOW;
void loop0() {
  // XXX trigger on a rising edge
  if (trigstate != digitalRead(_TRIG_PIN) && trigstate == HIGH) {
    trigcnt += 1;
    trigstate = !trigstate;
  }
