 
   wait_busy();
 
+  // attach an interrupt to our trigger
+  attachInterrupt(_TRIG_INT, trig_ISR, FALLING);
+
   Serial.begin(115200);
   Serial.println("Ready");
+  Serial.println(millis());
 }
 
 /**


  uint8_t lbyte = PINC;

  interrupts();

  return (hbyte<<8 | lbyte);
}

uint8_t trigcnt = 0;
uint8_t trigstate = LOW;
int16_t cnt = 0;

void loop() {
  loop0();
}

int16_t buf[4];

void loop1() {
  buf[0] = read_analog(1);

  Returned value is 2s complemented 16 bit integer.
  */
int16_t read_analog(uint8_t next_chan) {

  // 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();

