 /**
  * This firmware is intended to interface with a ADS7825 from TI/BB, and
  * provide digital codes to the control software over USB-Serial.
+ * 
+ * The software responds to the following serial commands:
+ *
+ * - r:  read all 4 channels, return results immediately via serial
+ * - sN: performs N scans of all 4 channels. Results are stored until p is
+ *       issued.
+ * - p: prints the buffer, used to retrive values from sN
  */
 
 // Adding _ prefix b/c arduino api uses some of these names otherwise


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

/**
  Waits for BUSY to go high
  */
void wait_busy() {
  while(digitalRead(_BUSY) == LOW) {
    digitalWrite(_LED, ~digitalRead(_BUSY));
  }

  // wait for busy to go high
  wait_busy();

  // elect the high byte for reading
  digitalWrite(_BYTE, LOW);

  // use port manipulation to read the data pins. Note that our pinmapping
  // is such that port C maps exactly onto the parallel output from the
