 #include "Cosa/Watchdog.hh"
 #include "Cosa/Memory.h"
 
-//#define USE_SD_ADAPTER
-#define USE_ETHERNET_SHIELD
+// #define USE_SD_ADAPTER
+#define USE_SD_DATA_LOGGING_SHIELD
+//#define USE_ETHERNET_SHIELD
 //#define USE_TFT_ST7735
 
 #if defined(WICKEDDEVICE_WILDFIRE) || defined(USE_SD_ADAPTER)

#elif defined(USE_TFT_ST7735)
SD sd;
OutputPin tft(Board::D10, 1);
#endif

#define SLOW_CLOCK SPI::DIV4_CLOCK

  // IOStream cout(&file);
  // cout.print((void*) NULL, 1024, IOStream::hex);
  stop = RTC::millis();
  ms = stop - start;
  trace << PSTR("Write file (") << K_BYTE << PSTR(" KByte,1024 Byte):")
	<< ms << PSTR(" ms (")
	<< K_BYTE * 1024.0 / ms << PSTR(" KBps)")
	<< endl
	<< endl;
  trace.flush();

  // Measure time to close a file
  start = RTC::millis();
  ASSERT(file.close());
  stop = RTC::millis();
  ms = stop - start;
  trace << PSTR("Close file:") << ms << PSTR(" ms") << endl;
  FAT16::ls(trace, FAT16::LS_DATE | FAT16::LS_SIZE);
  trace << endl;
  trace.flush();

  // Repen the time and measure the time to read character
  ASSERT(file.open("TMP.TXT", O_READ));
  start = RTC::millis();
  size = 0;
  while ((c = file.getchar()) != -1) size++;
  stop = RTC::millis();
  ms = stop - start;
  ASSERT(file.close());
  trace << PSTR("Read file (") << size / 1024
	<< PSTR("KByte,1 Byte):") << ms << PSTR(" ms (")
	<< size * 1.0 / ms << PSTR(" KBps)")
	<< endl;
  trace.flush();

  // Reopen the time and measure the time to read a smaller buffer
  ASSERT(file.open("TMP.TXT", O_READ));
  size = 0;
  start = RTC::millis();
  while ((count = file.read(buf, sizeof(buf))) > 0) size += count;
  stop = RTC::millis();
  ms = stop - start;
  ASSERT(file.close());
  trace << PSTR("Read file (") << size / 1024
	<< PSTR(" KByte,") << sizeof(buf) << PSTR(" Byte):")
	<< ms << PSTR(" ms (")
	<< size * 1.0 / ms << PSTR(" KBps)")
	<< endl
	<< endl;
  trace.flush();

  // Remove the file and list
  start = RTC::millis();
  ASSERT(FAT16::rm("TMP.TXT"));
  stop = RTC::millis();
  ms = stop - start;
  trace << PSTR("Remove file:") << ms << PSTR(" ms") << endl;
  FAT16::ls(trace, FAT16::LS_DATE | FAT16::LS_SIZE);
  trace << endl;
  trace.flush();

  // Open a new file and write a short message. Measure total time
  start = RTC::millis();
