 /**** display prepare functions ****/
 
 void clearScreen() {
-  screen.clearScreen();
+	screen.clearScreen();
 }
 
 
 void reset() {
-  // reset all global variables
-  current_state = STATE_RESET;
-  //  last_key_press_ms = 0;
-  //  last_key = 0;
-  memset(nfc_key, 0, sizeof(nfc_key));
-  nfc_key_count = 0;
-
-  // show the splash screen
-  showSplashScreen();
-
-  // reset the sd card controller
-  // sd.setup();
-
-  // reset the touchscreen
-  uint16_t x, y;
-  uint8_t z;  
-  while (!screen.getTouchScreen().bufferEmpty()) {
-    screen.getTouchScreen().readData(&x, &y, &z);
-    Serial.println(screen.getTouchScreen().bufferSize());
-  }
-  screen.getTouchScreen().writeRegister8(STMPE_INT_STA, 0xFF);
-
-  // setup nfc
-  nfclib.setupHost();
-
-  // show the nfc screen
-  showNFCKeyScreen();
+	// reset all global variables
+	current_state = STATE_RESET;
+	//  last_key_press_ms = 0;
+	//  last_key = 0;
+	memset(nfc_key, 0, sizeof(nfc_key));
+	nfc_key_count = 0;
+
+	// show the splash screen
+	showSplashScreen();
+
+	// reset the sd card controller
+	// sd.setup();
+
+	// reset the touchscreen
+	uint16_t x, y;
+	uint8_t z;  
+	while (!screen.getTouchScreen().bufferEmpty()) {
+		screen.getTouchScreen().readData(&x, &y, &z);
+		Serial.println(screen.getTouchScreen().bufferSize());
+	}
+	screen.getTouchScreen().writeRegister8(STMPE_INT_STA, 0xFF);
+
+	// setup nfc
+	nfclib.setupHost();
+
+	// show the nfc screen
+	showNFCKeyScreen();
 }
 
 

NFCLib nfclib;

char nfc_key[6] = { 
  0, 0, 0, 0, 0, 0 }; // the key buffer
uint8_t nfc_key_count = 0;



/**** show screen functions ****/

void showSplashScreen() {
	screen.fillScreen(ILI9341_BLACK);  
	screen.setCursor(BOXSIZE, BOXSIZE);
	screen.setTextColor(ILI9341_RED);  
	screen.setTextSize(4);
	screen.println(screen_message[0]);

	screen.setCursor(BOXSIZE*3, BOXSIZE*3);
	screen.setTextColor(ILI9341_WHITE);  
	screen.setTextSize(2);
	screen.println(screen_message[1]);
}


void showNFCKeyScreen() {
	current_state = STATE_NFC_KEY_LOGIN;
	clearScreen();
	screen.writeTextToTop(screen_message[2]);
	screen.writeTextToBottom(screen_message[3]);
	screen.drawKeyboard();
}

void showNFCCardScreen() {
	current_state = STATE_NFC_CARD_LOGIN;
	clearScreen();
	screen.writeTextToTop(screen_message[2]);
	screen.writeTextToBottom(screen_message[4]);
}


void showDataScreen() {
	current_state = STATE_SHOW_DATA;
	screen.fillScreen(ILI9341_BLACK);  
	screen.setCursor(0, 0);
	screen.setTextColor(ILI9341_WHITE);  
	screen.setTextSize(2);
	screen.println("The data:");

	screen.setCursor(BOXSIZE*2, BOXSIZE*2);
	screen.println("MY SECRET DATA !!");

	//  sd.showFile("test.txt");

	delay(3000);
}


