-//  ZXKBFirmware v.05
+//  ZXKBFirmware v1.0
 //  Copyright 2016 Mike Daley
 
 #include <Keyboard.h>
+#include "keys.h"
 
 const int dataLines = 5;
 const int addressLines = 8;
 const int dataPin[dataLines] = {A0, A1, A2, A3, 15};          // The Pro-Micro does not have an A4 pin so using 15
 const int address[addressLines] = {2, 3, 4, 5, 6, 7, 8, 9};
-const int keyboardModeSpeakerPin = 10;                            // When LED is on keyboard is in special mode
+const int keyboardModeSpeakerPin = 10;                        // Speak will beep based on mode 1 = Spectrum, 2 = Fuse, 3 = PC
 const int keyboardModeButtonPin = 14;                         
 
 // Tracking when special keys that need us to send specific USB keyboard values have been pressed means that

  
}

void loop() {
  
  // Check of the keyboard mode button has been pressed, if so then register its press, otherwise 

};
int keyboardMode;

// Spectrum 16k/14k keyboard matrix. This matrix layout matches the hardware layout
int spectrumKeyMap[addressLines][dataLines] = {
// 0---------------1-------------2------3------4  
  {KEY_1,          KEY_2,        KEY_3, KEY_4, KEY_5}, // 0
  {KEY_Q,          KEY_W,        KEY_E, KEY_R, KEY_T}, // 1
  {KEY_A,          KEY_S,        KEY_D, KEY_F, KEY_G}, // 2
  {KEY_0,          KEY_9,        KEY_8, KEY_7, KEY_6}, // 3
  {KEY_P,          KEY_O,        KEY_I, KEY_U, KEY_Y}, // 4
  {KEY_LEFT_SHIFT, KEY_Z,        KEY_X, KEY_C, KEY_V}, // 5
  {KEY_RETURN    , KEY_L,        KEY_K, KEY_J, KEY_H}, // 6
  {KEY_SPACE     , KEY_LEFT_ALT, KEY_M, KEY_N, KEY_B}, // 7
};

// Fuse keyboard matrix.  When running FUSE-SDL on the Pi, to get to options you need to 
// press F1 which is not on the Spectrum+ keyboard, so moving to Fuse keyboard mode (2xbeeps)
// means that press 1 through 9 provides F1 - F9, plus a couple of other keys such as enter
int fuseKeyMap[addressLines][dataLines] = {
// 0----------1-------2-------3-------4  
  {KEY_F1,    KEY_F2, KEY_F3, KEY_F4, KEY_F5},
  {KEY_ESC,   0,      0,      0,      0},
  {0,         0,      0,      0,      0},
  {KEY_F10,   KEY_F9, KEY_F8, KEY_F7, KEY_F6},
  {0,         0,      0,      0,      0},
  {0,         0,      0,      0,      0},
  {KEY_RETURN,        0,      0,      0, 0},
  {KEY_SPACE,         0,      0,      0, 0}  
};

// PC Normal keyboard matrix
int pcKeyMapNormal[addressLines][dataLines] = {
// 0---------------1-------------2------3------4  
  {KEY_1,          KEY_2,        KEY_3, KEY_4, KEY_5}, // 0
  {KEY_Q,          KEY_W,        KEY_E, KEY_R, KEY_T}, // 1
  {KEY_A,          KEY_S,        KEY_D, KEY_F, KEY_G}, // 2
  {KEY_0,          KEY_9,        KEY_8, KEY_7, KEY_6}, // 3
  {KEY_P,          KEY_O,        KEY_I, KEY_U, KEY_Y}, // 4
  {KEY_LEFT_SHIFT, KEY_Z,        KEY_X, KEY_C, KEY_V}, // 5
  {KEY_RETURN    , KEY_L,        KEY_K, KEY_J, KEY_H}, // 6
  {KEY_SPACE     , KEY_LEFT_ALT, KEY_M, KEY_N, KEY_B}, // 7
}; 

// PC Shifted keyboard matrix. 
int pcKeyMapShifted[addressLines][dataLines] = {
// 0---------------1-------------2----------------3-------------4  
  {KEY_1,          KEY_2,        KEY_3,           KEY_4,        KEY_LEFT_ARROW}, // 0
  {KEY_Q,          KEY_W,        KEY_E,           KEY_R,        KEY_T},          // 1
  {KEY_A,          KEY_S,        KEY_D,           KEY_F,        KEY_G},          // 2
  {KEY_0,          KEY_9,        KEY_RIGHT_ARROW, KEY_UP_ARROW, KEY_DOWN_ARROW}, // 3
  {KEY_P,          KEY_O,        KEY_I,           KEY_U,        KEY_Y},          // 4
  {KEY_LEFT_SHIFT, KEY_Z,        KEY_X,           KEY_C,        KEY_V},          // 5
  {KEY_RETURN    , KEY_L,        KEY_K,           KEY_J,        KEY_H},          // 6
  {KEY_BACKSPACE , KEY_LEFT_ALT, KEY_M,           KEY_N,        KEY_B},          // 7
}; 

// Array used to store the state of indiviaul keys that have been pressed
bool keyPressed[addressLines][dataLines] = {
