 }
 
 
+//------------------------------------------------------------------------------------------------
+
 void sendHexByte(byte val)
 {
   Serial.write(tohexch(val>>4)); // high nybble

#define LED_D1       14
#define LED_D0       15

// Set to 8, will only read IN phase
// Set to 16, will read and collect OUT phase also
// Must see all CARD_ROWS rows to get a OK report

}


//------------------------------------------------------------------------------------------------
// Show card data on feedback LEDs

void writeLEDs(byte reg, byte data)
{
  digitalWrite(LED_REG, reg?HIGH:LOW);

  //TODO: Consider putting data LEDs on an 8 bit port to allow a single write
  //TODO: Consider running through crossbar if pins need remapping
  digitalWrite(LED_D7,  (data&(1<<7))?HIGH:LOW);
  //digitalWrite(LED_D6,  data&(1<<6));
  //digitalWrite(LED_D5,  data&(1<<5));
  //digitalWrite(LED_D4,  data&(1<<4));
  //digitalWrite(LED_D3,  data&(1<<3));
  //digitalWrite(LED_D2,  data&(1<<2));
  //digitalWrite(LED_D1,  data&(1<<1));
  //digitalWrite(LED_D0,  data&(1<<0));
}


//------------------------------------------------------------------------------------------------

void sendCardReport(byte type, byte* pData, byte len)
{
