 /**
-   <h1>Pianoduino</h1>
-   61 key MIDI Keyboard with Arduino Uno Code, 24 shiftout outputs, 24 shiftin inputs
-   1 resistive touchscreen and 16 analog I/O.
-   @author Malcolm Davis
-   @version 0.1
-   @since 2017-02-03
-*/
-
-//Arduino Pins
+ * <h1>Pianoduino</h1>
+ * 61 key MIDI Keyboard with Arduino Uno Code, 24 shiftout outputs, 24 shiftin inputs
+ * 1 resistive touchscreen and 16 analog I/O.
+ * @author Malcolm Davis
+ * @version 0.1
+ * @since 2017-02-03
+ */
+
+//*********************Arduino Pins*************************//
 static const byte muxAPin = 2;
 static const byte muxBPin = 3;
 static const byte muxCPin = 4;

}

/**
   Method to shift the registers to a matrix column
   @param pColumn the column you wish to shift to.
   @return void
*/
void shiftToColumn(byte pColumn) {
  if(debug){
    Serial.print("Shifting to column: ");
    Serial.println(pColumn);
    delay(10);
  }
  digitalWrite(latchPin, LOW);
  if (pColumn < 8) {
    shiftOut(dataPin, outClkPin, MSBFIRST, mask[pColumn]);
    shiftOut(dataPin, outClkPin, MSBFIRST, blank);
    shiftOut(dataPin, outClkPin, MSBFIRST, mask[pColumn]);
  } else {
    shiftOut(dataPin, outClkPin, MSBFIRST, mask[pColumn % 8]);
    shiftOut(dataPin, outClkPin, MSBFIRST, mask[pColumn % 8]);
    shiftOut(dataPin, outClkPin, MSBFIRST, blank);
  }
  digitalWrite(latchPin, HIGH);
  if(debug){
    Serial.println("Shift done.");
  }
  delayMicroseconds(5);
}

/**
   Method to transpose the notes
   @param pDir direction to transpose
*/
void transpose(byte pDir) {
  if (-3 < trans + pDir ) {
    if (trans + pDir < 5) {
      trans = trans + pDir;
    } else {
      trans = 4;
    }
  } else {
    trans = -2;
  }
  for (byte i = 0; i <  sizeof(keyMidi) / sizeof(byte); i++) {

}

/**
 * Method to scan the values of all the inputs of the shiftregisters
 */
void scanRows() {
#ifdef debug 
  Serial.println("Scanning rows start");
  Serial.print("Load pin: ");
  Serial.println(loadPin);
  Serial.print("inEnPin pin: ");
  Serial.println(inEnPin);
  Serial.print("inReadPin pin: ");
  Serial.println(inReadPin);
  delay(10);
#endif
  digitalWrite(loadPin, LOW); //On Low the parallel data is collected
  delayMicroseconds(5);
  digitalWrite(loadPin, HIGH); //On HIGH is read ready
