Library for TM1637 LEDcontroller

Dependents:   mbed_TM1637 TM1637_test

See here for more information.

Files at this revision

API Documentation at this revision

Comitter:
wim
Date:
Fri Oct 06 16:43:56 2017 +0000
Parent:
0:dc8789a6e21f
Commit message:
Added RobotDyn 6 Digit module,; Added Eyewink 6 Digit + 5 Keys module,; Constructor adapted to 2 pins: dio, clk

Changed in this revision

Font_7Seg.cpp Show annotated file Show diff for this revision Revisions of this file
Font_7Seg.h Show annotated file Show diff for this revision Revisions of this file
TM1637.cpp Show annotated file Show diff for this revision Revisions of this file
TM1637.h Show annotated file Show diff for this revision Revisions of this file
TM1637_Config.h Show annotated file Show diff for this revision Revisions of this file
--- a/Font_7Seg.cpp	Sat Jan 30 20:35:25 2016 +0000
+++ b/Font_7Seg.cpp	Fri Oct 06 16:43:56 2017 +0000
@@ -1,5 +1,8 @@
 /* mbed LED Font Library, for TM1637 LED controller
  * Copyright (c) 2016, v01: WH, Initial version, Test in CATALEX
+ *               2017, v02: WH, Added RobotDyn 6 Digit module,
+ *                          Added Eyewink 6 Digit + 5 Keys module,    
+ *                          Constructor adapted to 2 pins: dio, clk  
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -22,14 +25,16 @@
 #include "Font_7Seg.h"
 
 // Select one of the testboards for TM1637 LED controller
-#if (CATALEX_TEST == 1) 
+#if ((EYEWINK_TEST == 1) || (ROBOTDYN_TEST == 1) || (CATALEX_TEST == 1))
 
 //Mask for blending out and restoring Icons
 const char MASK_ICON_GRID[] = {
                                 LO(S7_ICON_GR1),
                                 LO(S7_ICON_GR2),
                                 LO(S7_ICON_GR3),
-                                LO(S7_ICON_GR4)
+                                LO(S7_ICON_GR4),
+                                LO(S7_ICON_GR5),
+                                LO(S7_ICON_GR6)                                                                
                               };
 
 // ASCII Font definition table for transmission to TM1637
--- a/Font_7Seg.h	Sat Jan 30 20:35:25 2016 +0000
+++ b/Font_7Seg.h	Fri Oct 06 16:43:56 2017 +0000
@@ -1,5 +1,8 @@
 /* mbed LED Font Library, for TM1637 LED Controller
  * Copyright (c) 2016, v01: WH, Initial version, Test in CATALEX
+ *               2017, v02: WH, Added RobotDyn 6 Digit module,
+ *                          Added Eyewink 6 Digit + 5 Keys module,   
+ *                          Constructor adapted to 2 pins: dio, clk  
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -25,8 +28,8 @@
 // Select one of the testboards for TM1637 controller
 #include "TM1637_Config.h"
 
-#if ((CATALEX_TEST == 1) || (TM1637_TEST == 1))
-// Segment bit positions for 7 Segment display using the CATALEX mapping for TM1637
+#if ((EYEWINK_TEST == 1) || (ROBOTDYN_TEST == 1) || (CATALEX_TEST == 1) || (TM1637_TEST == 1))
+// Segment bit positions for 7 Segment display using the CATALEX and ROBOTDYN mapping for TM1637
 // Modify this table for different 'bit-to-segment' mappings. The ASCII character defines and the FONT_7S const table below 
 // will be adapted automatically according to the bit-to-segment mapping. Obviously this will only work when the segment
 // mapping is identical for every digit position. This will be the case unless the hardware designer really hates software developers.
@@ -55,6 +58,33 @@
 //Mask for blending out and setting 7 segments digits
 #define MASK_7S_ALL = (S7_A | S7_B | S7_C | S7_D | S7_E | S7_F | S7_G}
 
+//The CATALAX mapping between Digit positions or Columns (Left to Right) and Grids (ie memory address) are:
+//The column numbers are:
+//   0   1   2   3
+//The Grids are:
+//  GR1 GR2 GR3 GR4
+//The memory addresses are:
+//   0   1   2   3
+
+
+//The ROBOTDYN mapping between Digit positions or columns (Left to Right) and Grids (ie memory address) are:
+//The column numbers are:
+//   0   1   2   3   4   5
+//The Grids are:
+//  GR3 GR2 GR1 GR6 GR5 GR4
+//The memory addresses are:
+//   2   1   0   5   4   3
+
+
+//The EYEWINK mapping between Digit positions or columns (Left to Right) and Grids (ie memory address) are:
+//The column numbers are:
+//   0   1   2   3   4   5
+//The Grids are:
+//  GR1 GR2 GR3 GR4 GR5 GR6
+//The memory addresses are:
+//   0   1   2   3   4   5
+
+
 //Icons Grid 1
 #define S7_DP1  0x0080
 #define S7_ICON_GR1 (0x0000)
@@ -69,13 +99,23 @@
 //Icons Grid 3
 #define S7_DP3  0x0080
 #define S7_ICON_GR3 (0x0000)
-//#define S7_ICON_GR3 (S7_LD3 | S7_DP3)
+//#define S7_ICON_GR3 (S7_DP3)
 
 //Icons Grid 4
 #define S7_DP4  0x0080
 #define S7_ICON_GR4 (0x0000)
 //#define S7_ICON_GR4 (S7_DP4)
 
+//Icons Grid 5
+#define S7_DP5  0x0080
+#define S7_ICON_GR5 (0x0000)
+//#define S7_ICON_GR5 (S7_DP5)
+
+//Icons Grid 6
+#define S7_DP6  0x0080
+#define S7_ICON_GR6 (0x0000)
+//#define S7_ICON_GR6 (S7_DP6)
+
 
 //Mask for blending out and restoring Icons
 extern const char MASK_ICON_GRID[]; 
--- a/TM1637.cpp	Sat Jan 30 20:35:25 2016 +0000
+++ b/TM1637.cpp	Fri Oct 06 16:43:56 2017 +0000
@@ -1,5 +1,8 @@
 /* mbed TM1637 Library, for TM1637 LED controller
  * Copyright (c) 2016, v01: WH, Initial version
+ *               2017, v02: WH, Added RobotDyn 6 Digit module,
+ *                          Added Eyewink 6 Digit + 6 Keys module,   
+ *                          Constructor adapted to 2 pins: dio, clk  
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -22,18 +25,46 @@
 #include "mbed.h" 
 #include "TM1637.h"
 
+#if(SPI==1)
 /** Constructor for class for driving TM1637 LED controller with Serial bus interface device. 
- *  @brief Supports 6 digits @ 8 segments. 
- *   
- *  @param  PinName mosi Serial bus MOSI pin
- *  @param  PinName miso Serial bus MISO pin 
- *  @param  PinName sclk Serial bus SCLK pin
-*/
-TM1637::TM1637(PinName mosi, PinName miso, PinName sclk) : _mosi(mosi), _miso(miso), _sclk(sclk) {
+  *
+  * @brief Supports 6 Grids @ 8 segments. Also supports upto 16 Keys. 
+  *        Serial bus interface device.
+  *        DEPRECATED version 
+  *
+  *  @param  PinName mosi_nc  Serial bus NC pin
+  *  @param  PinName miso_dio Serial bus DIO pin  
+  *  @param  PinName sclk_clk Serial bus CLK pin 
+  */
+TM1637::TM1637(PinName mosi_nc, PinName miso_dio, PinName sclk_clk) : _mosi_nc(mosi_nc), _dio(miso_dio), _clk(sclk_clk) {
 
   _init();
 }
 
+/** Constructor for class for driving TM1637 LED controller with Serial bus interface device. 
+ *  @brief Supports 6 digits @ 8 segments. Also supports upto 16 Keys.
+ *   
+ *  @param  PinName dio Serial bus DIO pin 
+ *  @param  PinName clk Serial bus CLK pin
+*/
+TM1637::TM1637(PinName dio, PinName clk) : _mosi_nc(NC), _dio(dio), _clk(clk) {
+
+  _init();
+}
+#else
+
+/** Constructor for class for driving TM1637 LED controller with Serial bus interface device. 
+ *  @brief Supports 6 digits @ 8 segments. Also supports upto 16 Keys.
+ *   
+ *  @param  PinName dio Serial bus DIO pin 
+ *  @param  PinName clk Serial bus CLK pin
+*/
+TM1637::TM1637(PinName dio, PinName clk) : _dio(dio), _clk(clk) {
+
+  _init();
+}
+
+#endif
 /** Init the Serial interface and the controller
   * @param  none
   * @return none
@@ -42,9 +73,14 @@
   
 //TM1637 uses a Serial bus that looks like I2C, but really is not.
 //It has Start and Stop conditions like I2C and an Ack pulse, but instead of slaveaddresses and a RW bit it just transmits commands and data.
+
 //init Serial bus
-  _mosi=1;
-  _sclk=1;  
+  _dio.output();
+//  _dio.mode(PullUp);
+  wait_us(1);
+
+  _dio=1;  
+  _clk=1;  
 
 //init controller  
   _display = TM1637_DSP_ON;
@@ -141,7 +177,6 @@
 /** Read keydata block from TM1637
   *  @param  *keydata Ptr to bytes for keydata
   *  @return bool keypress True when at least one key was pressed
-  *
   */   
 bool TM1637::getKeys(KeyData_t *keydata) {
 
@@ -151,7 +186,9 @@
   _write(TM1637_DATA_SET_CMD | TM1637_KEY_RD | TM1637_ADDR_INC | TM1637_MODE_NORM); // Data set cmd, normal mode, auto incr, read data
 
   // Read keys
-  *keydata = _read(0xFF);
+  // Bitpattern S0 S1 S2 K1 K2 1 1 1  
+  *keydata = _read();
+//  printf("Key = 0x%02x\r\n", *keydata);
 
   _stop();  
   
@@ -168,9 +205,9 @@
   */ 
 void TM1637::_start() {
 
-  _mosi=0;
+  _dio=0;
   wait_us(1);
-  _sclk=0;
+  _clk=0;
   wait_us(1);
 }
   
@@ -180,11 +217,11 @@
   */ 
 void TM1637::_stop() {
 
-  _mosi=0;
+  _dio=0;
   wait_us(1);  
-  _sclk=1;
+  _clk=1;
   wait_us(1);
-  _mosi=1;
+  _dio=1;
   wait_us(1);
 }
 
@@ -197,65 +234,85 @@
   for (int bit=0; bit<8; bit++) {    
     //The TM1637 expects LSB first
     if (((data >> bit) & 0x01) == 0x01) {
-      _mosi=1;      
+      _dio=1;      
     }
     else {    
-      _mosi=0;      
+      _dio=0;      
     }  
     wait_us(1);
-    _sclk=1;
+    _clk=1;
     wait_us(1);
-    _sclk=0;  
+    _clk=0;  
     wait_us(1);
   }  
+
+  _dio=1;
   
+  // Prepare DIO to read data
+  _dio.input();
+  wait_us(3);
+      
   // dummy Ack
-  _sclk=1;
+  _clk=1;
   wait_us(1);
-  _sclk=0;  
+//  _ack = _dio;  
+  _clk=0;  
   wait_us(1); 
+  
+  // Return DIO to output mode
+  _dio.output();  
+  wait_us(3);  
+
+  _dio=1; //idle  
 }
 
 /** Read byte from TM1637
-  *  @param  int senddata
   *  @return read byte 
   */ 
-char TM1637::_read(int data) {
+char TM1637::_read() {
   char keycode = 0;
-   
-  for (int bit=0; bit<8; bit++) {    
-    
-    // Prepare to read next bit, LSB first    
-    keycode = keycode << 1;  
+
+  // Prepare DIO to read data
+  _dio.input();
+  wait_us(3);
     
-    //The TM1637 expects LSB first
-    if (((data >> bit) & 0x01) == 0x01) {
-      _mosi=1;      
-    }
-    else {    
-      _mosi=0;      
-    }  
+  for (int bit=0; bit<8; bit++) {    
+   
+    //The TM1637 sends bitpattern: S0 S1 S2 K1 K2 1 1 1
+    //Data is shifted out by the TM1637 on the falling edge of CLK
+    //Observe sufficient delay to allow the Open Drain DIO to rise to H levels
+    // Prepare to read next bit, LSB (ie S0) first. 
+    // The code below flips bits for easier matching with datasheet
+    keycode = keycode << 1;  
+
+    _clk=1;
     wait_us(1);
-    _sclk=1;
-    wait_us(1);
+    
+    // Read next bit
+    if (_dio) { keycode |= 0x01; }        
 
-    // Read next bit, LSB first
-    if (_miso) { keycode |= 0x01; }
-
-    _sclk=0;  
-    wait_us(1);
+    _clk=0;        
+    wait_us(5); // Delay to allow for slow risetime
   }  
   
+  // Return DIO to output mode
+  _dio.output();
+  wait_us(3);  
+
   // dummy Ack
-  _sclk=1;
+  _dio=0; //Ack   
   wait_us(1);
-  _sclk=0;  
+  
+  _clk=1;
+  wait_us(1);
+  _clk=0;  
   wait_us(1); 
 
+  _dio=1; //idle
+
   return keycode;
 }
 
-
 /** Write command and parameter to TM1637
   *  @param  int cmd Command byte
   *  &Param  int data Parameters for command
@@ -275,15 +332,31 @@
 // Derived class for TM1637 used in LED&KEY display unit
 //
 
+#if(SPI==1)
 /** Constructor for class for driving TM1637 LED controller as used in CATALEX
   *
-  *  @brief Supports 8 Digits of 7 Segments + DP.
+  *  @brief Supports 4 Digits of 7 Segments + DP (or Colon for Digit2 on some models).
+  *         DEPRECATED version 
   *   
-  *  @param  PinName mosi Serial bus MOSI pin
-  *  @param  PinName miso Serial bus MISO pin  
-  *  @param  PinName sclk Serial bus SCLK pin
+  *  @param  PinName mosi_nc  Serial bus NC pin
+  *  @param  PinName miso_dio Serial bus DIO pin  
+  *  @param  PinName sclk_clk Serial bus CLK pin
   */
-TM1637_CATALEX::TM1637_CATALEX(PinName mosi, PinName miso, PinName sclk) : TM1637(mosi, miso, sclk) {
+TM1637_CATALEX::TM1637_CATALEX(PinName mosi_nc, PinName miso_dio, PinName sclk_clk) : TM1637(mosi_nc, miso_dio, sclk_clk) {
+  _column  = 0;
+  _columns = CATALEX_NR_DIGITS;    
+}  
+#endif
+
+/** Constructor for class for driving TM1637 LED controller
+ *
+ * @brief Supports 4 Digits of 7 Segments + DP (or Colon for Digit2 on some models).
+ *        Serial bus interface device. 
+ *
+ *  @param  PinName dio Serial bus DIO pin
+ *  @param  PinName sck Serial bus CLK pin 
+ */
+TM1637_CATALEX::TM1637_CATALEX(PinName dio, PinName clk) : TM1637(dio, clk) {
   _column  = 0;
   _columns = CATALEX_NR_DIGITS;    
 }  
@@ -346,7 +419,7 @@
     }  
   }
 
-  writeData(_displaybuffer, (CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID));
+  writeData(_displaybuffer, (CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID), 0);
 
   _column = 0;   
 }     
@@ -365,7 +438,7 @@
     
   //Save char...and set bits for icon to write
   _displaybuffer[addr] = _displaybuffer[addr] | LO(icn);      
-//  writeData(_displaybuffer, (CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID));
+//  writeData(_displaybuffer, (CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID), 0);
   writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr);  
 }
 
@@ -383,7 +456,7 @@
     
   //Save char...and clr bits for icon to write
   _displaybuffer[addr] = _displaybuffer[addr] & ~LO(icn);      
-//  writeData(_displaybuffer, (CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID));
+//  writeData(_displaybuffer, (CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID), 0);
   writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr);    
 }
 
@@ -408,6 +481,11 @@
 /** Write a single character (Stream implementation)
   */
 int TM1637_CATALEX::_putc(int value) {
+//The CATALAX mapping between Digit positions (Left to Right) and Grids is:
+//  GR1 GR2 GR3 GR4
+//The memory addresses or column numbers are:
+//   0   1   2   3
+    
     int addr;
     bool validChar = false;
     char pattern   = 0x00;
@@ -505,3 +583,490 @@
 }
 
 #endif
+
+#if (ROBOTDYN_TEST == 1) 
+// Derived class for TM1637 used in ROBOTDYN display unit
+//
+
+/** Constructor for class for driving TM1637 LED controller as used in ROBOTDYN
+  *
+  *  @brief Supports 6 Digits of 7 Segments + DP.
+  *   
+  *  @param  PinName dio Serial bus DIO pin
+  *  @param  PinName clk Serial bus CLK pin
+  */
+TM1637_ROBOTDYN::TM1637_ROBOTDYN(PinName dio, PinName clk) : TM1637(dio, clk) {
+  _column  = 0;
+  _columns = ROBOTDYN_NR_DIGITS;    
+}  
+
+
+#if(0)
+#if DOXYGEN_ONLY
+    /** Write a character to the Display
+     *
+     * @param c The character to write to the display
+     */
+    int putc(int c);
+
+    /** Write a formatted string to the Display
+     *
+     * @param format A printf-style format string, followed by the
+     *               variables to use in formatting the string.
+     */
+    int printf(const char* format, ...);   
+#endif
+#endif
+
+/** Locate cursor to a screen column
+  *
+  * @param column  The horizontal position from the left, indexed from 0
+  */
+void TM1637_ROBOTDYN::locate(int column) {
+  //sanity check
+  if (column < 0) {column = 0;}
+  if (column > (_columns - 1)) {column = _columns - 1;}  
+  
+  _column = column;       
+}
+
+
+/** Number of screen columns
+  *
+  * @param none
+  * @return columns
+  */
+int TM1637_ROBOTDYN::columns() {
+    return _columns;
+}
+
+    
+/** Clear the screen and locate to 0
+  * @param bool clrAll Clear Icons also (default = false)
+  */ 
+void TM1637_ROBOTDYN::cls(bool clrAll) {  
+
+  if (clrAll) {
+    //clear local buffer (including Icons)
+    for (int idx=0; idx < ROBOTDYN_NR_GRIDS; idx++) {
+      _displaybuffer[idx] = 0x00;  
+    }
+  }  
+  else {
+    //clear local buffer (preserving Icons)
+    for (int idx=0; idx < ROBOTDYN_NR_GRIDS; idx++) {
+      _displaybuffer[idx] = _displaybuffer[idx] & MASK_ICON_GRID[idx];  
+    }  
+  }
+
+  writeData(_displaybuffer, (ROBOTDYN_NR_GRIDS * TM1637_BYTES_PER_GRID), 0);
+
+  _column = 0;   
+}     
+
+/** Set Icon
+  *
+  * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+  * @return none
+  */
+void TM1637_ROBOTDYN::setIcon(Icon icon) {
+  int addr, icn;
+
+   icn =        icon  & 0xFFFF;
+  addr = (icon >> 24) & 0xFF; 
+  addr = (addr - 1);
+    
+  //Save char...and set bits for icon to write
+  _displaybuffer[addr] = _displaybuffer[addr] | LO(icn);      
+//  writeData(_displaybuffer, (ROBOTDYN_NR_GRIDS * TM1637_BYTES_PER_GRID), 0);
+  writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr);  
+}
+
+/** Clr Icon
+  *
+  * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+  * @return none
+  */
+void TM1637_ROBOTDYN::clrIcon(Icon icon) {
+  int addr, icn;
+
+   icn =        icon  & 0xFFFF;
+  addr = (icon >> 24) & 0xFF; 
+  addr = (addr - 1);
+    
+  //Save char...and clr bits for icon to write
+  _displaybuffer[addr] = _displaybuffer[addr] & ~LO(icn);      
+//  writeData(_displaybuffer, (ROBOTDYN_NR_GRIDS * TM1637_BYTES_PER_GRID), 0);
+  writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr);    
+}
+
+
+/** Set User Defined Characters (UDC)
+  *
+  * @param unsigned char udc_idx  The Index of the UDC (0..7)
+  * @param int udc_data           The bitpattern for the UDC (8 bits)       
+  */
+void TM1637_ROBOTDYN::setUDC(unsigned char udc_idx, int udc_data) {
+
+  //Sanity check
+  if (udc_idx > (ROBOTDYN_NR_UDC-1)) {
+    return;
+  }
+  // Mask out Icon bits?
+
+  _UDC_7S[udc_idx] = LO(udc_data);
+}
+
+/** Write a single character (Stream implementation)
+  *
+  */
+int TM1637_ROBOTDYN::_putc(int value) {
+//The ROBOTDYN mapping between Digit positions (Left to Right) and Grids is:
+//  GR3 GR2 GR1 GR6 GR5 GR4
+//The memory addresses or column numbers are:
+//   2   1   0   5   4   3
+//The Grids are reversed for 2 sets of 3 digits: 
+    const int col2addr[] = {2, 1, 0, 5, 4, 3};
+
+    int addr;
+    bool validChar = false;
+    char pattern   = 0x00;
+    
+    if ((value == '\n') || (value == '\r')) {
+      //No character to write
+      validChar = false;
+      
+      //Update Cursor      
+      _column = 0;
+    }
+    else if ((value == '.') || (value == ',')) {
+      //No character to write
+      validChar = false;
+      pattern = S7_DP; // placeholder for all DPs
+      
+      // Check to see that DP can be shown for current column
+      if (_column > 0) {
+        //Translate between _column and displaybuffer entries
+        //Add DP to bitpattern of digit left of current column.
+        addr = col2addr [_column - 1];
+      
+        //Save icons...and set bits for decimal point to write
+        _displaybuffer[addr] = _displaybuffer[addr] | pattern;
+//        writeData(_displaybuffer, (ROBOTDYN_NR_GRIDS * TM1637_BYTES_PER_GRID));
+        writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr); 
+        
+        //No Cursor Update
+      }
+    }
+    else if ((value >= 0) && (value < ROBOTDYN_NR_UDC)) {
+      //Character to write
+      validChar = true;
+      pattern = _UDC_7S[value];
+    }  
+    
+#if (SHOW_ASCII == 1)
+    //display all ASCII characters
+    else if ((value >= FONT_7S_START) && (value <= FONT_7S_END)) {   
+      //Character to write
+      validChar = true;
+      pattern = FONT_7S[value - FONT_7S_START];
+    } // else
+#else    
+    //display only digits and hex characters      
+    else if (value == '-') {
+      //Character to write
+      validChar = true;
+      pattern = C7_MIN;         
+    }
+    else if ((value >= (int)'0') && (value <= (int) '9')) {   
+      //Character to write
+      validChar = true;
+      pattern = FONT_7S[value - (int) '0'];
+    }
+    else if ((value >= (int) 'A') && (value <= (int) 'F')) {   
+      //Character to write
+      validChar = true;
+      pattern = FONT_7S[10 + value - (int) 'A'];
+    }
+    else if ((value >= (int) 'a') && (value <= (int) 'f')) {   
+      //Character to write
+      validChar = true;
+      pattern = FONT_7S[10 + value - (int) 'a'];
+    } //else
+#endif
+
+    if (validChar) {
+      //Character to write
+ 
+      //Translate between _column and displaybuffer entries
+      addr = col2addr[_column];
+
+      //Save icons...and set bits for character to write
+      _displaybuffer[addr] = (_displaybuffer[addr] & MASK_ICON_GRID[_column]) | pattern;
+
+//      writeData(_displaybuffer, (ROBOTDYN_NR_GRIDS * TM1637_BYTES_PER_GRID));
+      writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr);        
+                                
+      //Update Cursor
+      _column++;
+      if (_column > (ROBOTDYN_NR_DIGITS - 1)) {
+        _column = 0;
+      }
+
+    } // if validChar           
+
+    return value;
+}
+
+
+// get a single character (Stream implementation)
+int TM1637_ROBOTDYN::_getc() {
+    return -1;
+}
+
+#endif
+
+
+#if (EYEWINK_TEST == 1) 
+// Derived class for TM1637 used in EYEWINK display unit
+//
+
+/** Constructor for class for driving TM1637 LED controller as used in EYEWINK
+  *
+  *  @brief Supports 6 Digits of 7 Segments + DP and 6 Keys.
+  *   
+  *  @param  PinName dio Serial bus DIO pin
+  *  @param  PinName clk Serial bus CLK pin
+  */
+TM1637_EYEWINK::TM1637_EYEWINK(PinName dio, PinName clk) : TM1637(dio, clk) {
+  _column  = 0;
+  _columns = EYEWINK_NR_DIGITS;    
+}  
+
+
+#if(0)
+#if DOXYGEN_ONLY
+    /** Write a character to the Display
+     *
+     * @param c The character to write to the display
+     */
+    int putc(int c);
+
+    /** Write a formatted string to the Display
+     *
+     * @param format A printf-style format string, followed by the
+     *               variables to use in formatting the string.
+     */
+    int printf(const char* format, ...);   
+#endif
+#endif
+
+/** Locate cursor to a screen column
+  *
+  * @param column  The horizontal position from the left, indexed from 0
+  */
+void TM1637_EYEWINK::locate(int column) {
+  //sanity check
+  if (column < 0) {column = 0;}
+  if (column > (_columns - 1)) {column = _columns - 1;}  
+  
+  _column = column;       
+}
+
+
+/** Number of screen columns
+  *
+  * @param none
+  * @return columns
+  */
+int TM1637_EYEWINK::columns() {
+    return _columns;
+}
+
+    
+/** Clear the screen and locate to 0
+  * @param bool clrAll Clear Icons also (default = false)
+  */ 
+void TM1637_EYEWINK::cls(bool clrAll) {  
+
+  if (clrAll) {
+    //clear local buffer (including Icons)
+    for (int idx=0; idx < EYEWINK_NR_GRIDS; idx++) {
+      _displaybuffer[idx] = 0x00;  
+    }
+  }  
+  else {
+    //clear local buffer (preserving Icons)
+    for (int idx=0; idx < EYEWINK_NR_GRIDS; idx++) {
+      _displaybuffer[idx] = _displaybuffer[idx] & MASK_ICON_GRID[idx];  
+    }  
+  }
+
+  writeData(_displaybuffer, (EYEWINK_NR_GRIDS * TM1637_BYTES_PER_GRID), 0);
+
+  _column = 0;   
+}     
+
+/** Set Icon
+  *
+  * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+  * @return none
+  */
+void TM1637_EYEWINK::setIcon(Icon icon) {
+  int addr, icn;
+
+   icn =        icon  & 0xFFFF;
+  addr = (icon >> 24) & 0xFF; 
+  addr = (addr - 1);
+    
+  //Save char...and set bits for icon to write
+  _displaybuffer[addr] = _displaybuffer[addr] | LO(icn);      
+//  writeData(_displaybuffer, (EYEWINK_NR_GRIDS * TM1637_BYTES_PER_GRID), 0);
+  writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr);  
+}
+
+/** Clr Icon
+  *
+  * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+  * @return none
+  */
+void TM1637_EYEWINK::clrIcon(Icon icon) {
+  int addr, icn;
+
+   icn =        icon  & 0xFFFF;
+  addr = (icon >> 24) & 0xFF; 
+  addr = (addr - 1);
+    
+  //Save char...and clr bits for icon to write
+  _displaybuffer[addr] = _displaybuffer[addr] & ~LO(icn);      
+//  writeData(_displaybuffer, (EYEWINK_NR_GRIDS * TM1637_BYTES_PER_GRID), 0);
+  writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr);    
+}
+
+
+/** Set User Defined Characters (UDC)
+  *
+  * @param unsigned char udc_idx  The Index of the UDC (0..7)
+  * @param int udc_data           The bitpattern for the UDC (8 bits)       
+  */
+void TM1637_EYEWINK::setUDC(unsigned char udc_idx, int udc_data) {
+
+  //Sanity check
+  if (udc_idx > (EYEWINK_NR_UDC-1)) {
+    return;
+  }
+  // Mask out Icon bits?
+
+  _UDC_7S[udc_idx] = LO(udc_data);
+}
+
+/** Write a single character (Stream implementation)
+  *
+  */
+int TM1637_EYEWINK::_putc(int value) {
+//The EYEWINK mapping between Digit positions (Left to Right) and Grids is:
+//  GR1 GR2 GR3 GR4 GR5 GR6
+//The memory addresses or column numbers are:
+//   0   1   2   3   4   5
+//The Grids for all digits: 
+//    const int col2addr[] = {0, 1, 2, 3, 4, 5};
+
+    int addr;
+    bool validChar = false;
+    char pattern   = 0x00;
+    
+    if ((value == '\n') || (value == '\r')) {
+      //No character to write
+      validChar = false;
+      
+      //Update Cursor      
+      _column = 0;
+    }
+    else if ((value == '.') || (value == ',')) {
+      //No character to write
+      validChar = false;
+      pattern = S7_DP; // placeholder for all DPs
+      
+      // Check to see that DP can be shown for current column
+      if (_column > 0) {
+        //Translate between _column and displaybuffer entries
+        //Add DP to bitpattern of digit left of current column.
+//        addr = col2addr [_column - 1];
+        addr = _column - 1;
+      
+        //Save icons...and set bits for decimal point to write
+        _displaybuffer[addr] = _displaybuffer[addr] | pattern;
+//        writeData(_displaybuffer, (EYEWINK_NR_GRIDS * TM1637_BYTES_PER_GRID));
+        writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr); 
+        
+        //No Cursor Update
+      }
+    }
+    else if ((value >= 0) && (value < EYEWINK_NR_UDC)) {
+      //Character to write
+      validChar = true;
+      pattern = _UDC_7S[value];
+    }  
+    
+#if (SHOW_ASCII == 1)
+    //display all ASCII characters
+    else if ((value >= FONT_7S_START) && (value <= FONT_7S_END)) {   
+      //Character to write
+      validChar = true;
+      pattern = FONT_7S[value - FONT_7S_START];
+    } // else
+#else    
+    //display only digits and hex characters      
+    else if (value == '-') {
+      //Character to write
+      validChar = true;
+      pattern = C7_MIN;         
+    }
+    else if ((value >= (int)'0') && (value <= (int) '9')) {   
+      //Character to write
+      validChar = true;
+      pattern = FONT_7S[value - (int) '0'];
+    }
+    else if ((value >= (int) 'A') && (value <= (int) 'F')) {   
+      //Character to write
+      validChar = true;
+      pattern = FONT_7S[10 + value - (int) 'A'];
+    }
+    else if ((value >= (int) 'a') && (value <= (int) 'f')) {   
+      //Character to write
+      validChar = true;
+      pattern = FONT_7S[10 + value - (int) 'a'];
+    } //else
+#endif
+
+    if (validChar) {
+      //Character to write
+ 
+      //Translate between _column and displaybuffer entries
+//      addr = col2addr[_column];
+      addr = _column;      
+
+      //Save icons...and set bits for character to write
+      _displaybuffer[addr] = (_displaybuffer[addr] & MASK_ICON_GRID[_column]) | pattern;
+
+//      writeData(_displaybuffer, (EYEWINK_NR_GRIDS * TM1637_BYTES_PER_GRID));
+      writeData(_displaybuffer, TM1637_BYTES_PER_GRID, addr);        
+                                
+      //Update Cursor
+      _column++;
+      if (_column > (EYEWINK_NR_DIGITS - 1)) {
+        _column = 0;
+      }
+
+    } // if validChar           
+
+    return value;
+}
+
+
+// get a single character (Stream implementation)
+int TM1637_EYEWINK::_getc() {
+    return -1;
+}
+
+#endif
\ No newline at end of file
--- a/TM1637.h	Sat Jan 30 20:35:25 2016 +0000
+++ b/TM1637.h	Fri Oct 06 16:43:56 2017 +0000
@@ -1,5 +1,8 @@
 /* mbed TM1637 Library, for TM1637 LED controller
  * Copyright (c) 2016, v01: WH, Initial version
+ *               2017, v02: WH, Added RobotDyn 6 Digit module,
+ *                          Added Eyewink 6 Digit + 6 Keys module,   
+ *                          Constructor adapted to 2 pins: dio, clk  
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -32,37 +35,43 @@
  * #include "mbed.h"
  * #include "TM1637.h" 
  * 
+ * Serial pc(USBTX, USBRX);
+ *
  * //DisplayData_t size is 6 bytes (6 grids @ 8 segments)
  * TM1637::DisplayData_t all_str  = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};  
  *
  * // KeyData_t size is 1 bytes  
  * TM1637::KeyData_t keydata; 
  *
- * // TM1637 declaration
- * TM1637 TM1637(p5,p6,p7);
+ * // TM1637 declaration, Select the desired type in TM1637_Config.h
+ * //TM1637_CATALEX CATALEX(p5,p6,p7);     //LPC1768 DEPRECATED version 
+ * TM1637_CATALEX CATALEX(p6, p7);       //LPC1768
+ * //TM1637_CATALEX CATALEX(D9, D10);      //F401
  *
  * int main() {
- *   TM1637.cls(); 
- *   TM1637.writeData(all_str);
+ *   CATALEX.cls(); 
+ *   CATALEX.writeData(all_str);
  *   wait(1);
- *   TM1637.setBrightness(TM1637_BRT0);
+ *   CATALEX.setBrightness(TM1637_BRT0);
  *   wait(1);
- *   TM1637.setBrightness(TM1637_BRT3);
+ *   CATALEX.setBrightness(TM1637_BRT3);
  *
  *   while (1) {
- *     TM1637.cls(); 
+ *     CATALEX.cls(); 
  *     wait(0.5); 
- *     TM1637.writeData(all_str);
- *     wait(0.5);
+ *     CATALEX.writeData(all_str);
+ *     wait(1.0);
+ *     CATALEX.cls(); 
+ *     CATALEX.printf(" HI ");  
+ *     wait(1.0); 
  *
  *     // Check and read keydata
- *     if (TM1637.getKeys(&keydata)) {
+ *     if (CATALEX.getKeys(&keydata)) {
  *       pc.printf("Keydata = 0x%02x\r\n", keydata);
  *
  *       if (keydata == TM1637_SW9_BIT) { //sw9  
- *         TM1637.cls(); 
- *         TM1637.writeData(0xFF, 1);
- *         TM1637.writeData(0xFF, 2);
+ *         CATALEX.cls(); 
+ *         CATALEX.printf("--09"); 
  *       }  
  *     } // Check keydata
  *   } // while 
@@ -117,6 +126,8 @@
 
 
 //Access to 16 Switches
+//S0 S1 S2 K1 K2 1 1 1
+//K1,K2 = 0 1
 #define TM1637_SW1_BIT      0xEF
 #define TM1637_SW2_BIT      0x6F
 #define TM1637_SW3_BIT      0xAF
@@ -126,6 +137,7 @@
 #define TM1637_SW7_BIT      0x8F
 #define TM1637_SW8_BIT      0x0F
 
+//K1,K2 = 1 0
 #define TM1637_SW9_BIT      0xF7
 #define TM1637_SW10_BIT     0x77
 #define TM1637_SW11_BIT     0xB7
@@ -139,7 +151,7 @@
 
 /** A class for driving TM1637 LED controller
  *
- * @brief Supports 6 Grids @ 8 Segments. 
+ * @brief Supports 6 Grids @ 8 Segments and 16 Keys. 
  *        Serial bus interface device. 
  */
 class TM1637 {
@@ -150,18 +162,32 @@
 
   /** Datatypes for keymatrix data */
   typedef char KeyData_t;
-    
+
+#if(SPI==1)    
  /** Constructor for class for driving TM1637 LED controller
   *
-  * @brief Supports 6 Grids @ 8 segments. 
+  * @brief Supports 6 Grids @ 8 segments and 16 Keys. 
+  *        Serial bus interface device.
+  *        DEPRECATED version 
+  *
+  *  @param  PinName mosi_nc  Serial bus NC pin
+  *  @param  PinName miso_dio Serial bus DIO pin  
+  *  @param  PinName sclk_clk Serial bus CLK pin 
+  */
+  TM1637(PinName mosi_nc, PinName miso_dio, PinName sclk_clk);
+#endif      
+
+ /** Constructor for class for driving TM1637 LED controller
+  *
+  * @brief Supports 6 Grids @ 8 segments and 16 Keys. 
   *        Serial bus interface device. 
   *
-  *  @param  PinName mosi Serial bus MOSI pin
-  *  @param  PinName miso Serial bus MISO pin  
-  *  @param  PinName sclk Serial bus SCLK pin 
+  *  @param  PinName dio Serial bus DIO pin
+  *  @param  PinName sck Serial bus CLK pin 
   */
-  TM1637(PinName mosi, PinName miso, PinName sclk);
-      
+  TM1637(PinName dio, PinName clk);
+
+
   /** Clear the screen and locate to 0
    */ 
   void cls();  
@@ -201,10 +227,13 @@
     */
   void setDisplay(bool on);
   
-  private:  
-    DigitalOut _mosi;
-    DigitalIn _miso;    
-    DigitalOut _sclk;  
+ private:  
+#if(SPI==1)
+    DigitalIn    _mosi_nc;  //Dummy to avoid breaking deprecated constructor    
+#endif
+    DigitalInOut _dio;
+    DigitalOut   _clk;  
+
     char _display;
     char _bright; 
   
@@ -234,10 +263,9 @@
     void _write(int data);
 
   /** Read byte from TM1637
-    *  @param  int senddata
     *  @return read byte 
     */ 
-    char _read(int data);
+    char _read();
 
   /** Write command and parameter to TM1637
     *  @param  int cmd Command byte
@@ -247,9 +275,8 @@
     void _writeCmd(int cmd, int data);  
 };
 
-
 #if (CATALEX_TEST == 1) 
-// Derived class for TM1637 used in CATALEX display unit
+// Derived class for TM1637 used in CATALEX display unit with 4 Digits
 //
 
 #include "Font_7Seg.h"
@@ -261,7 +288,8 @@
 
 /** Constructor for class for driving TM1637 controller as used in CATALEX
   *
-  *  @brief Supports 4 Digits of 7 Segments + DP.
+  *  @brief Supports 4 Digits of 7 Segments + DP (or Colon for Digit2 on some models). 
+  *         Also Supports up to 16 Keys. Serial bus interface device. 
   *  
   *  @param  PinName mosi Serial bus MOSI pin
   *  @param  PinName miso Serial bus MISO pin  
@@ -273,21 +301,41 @@
   /** Enums for Icons */
   //  Grid encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
   enum Icon {
+    DP1   = ( 1<<24) | S7_DP1,  /**<  Digit 1 */
+    DP2   = ( 2<<24) | S7_DP2,  /**<  Digit 2 */
+    DP3   = ( 3<<24) | S7_DP3,  /**<  Digit 3 */
+    DP4   = ( 4<<24) | S7_DP4,  /**<  Digit 4 */
+
     COL2  = ( 2<<24) | S7_DP2,  /**<  Column 2 */
   };
   
   typedef char UDCData_t[CATALEX_NR_UDC];
-  
+
+#if (SPI==1)  
  /** Constructor for class for driving TM1637 LED controller as used in CATALEX
-   *
-   * @brief Supports 4 Digits of 7 Segments + DP.
-   *  
-   *  @param  PinName mosi Serial bus MOSI pin
-   *  @param  PinName mis0 Serial bus MISO pin  
-   *  @param  PinName sclk Serial bus SCLK pin 
+  *
+  * @brief Supports 4 Digits of 7 Segments + DP (or Colon for Digit2 on some models).
+  *        Also Supports up to 16 Keys. Serial bus interface device.      
+  *        DEPRECATED version 
+  *
+  *  @param  PinName mosi_nc  Serial bus NC pin
+  *  @param  PinName miso_dio Serial bus DIO pin  
+  *  @param  PinName sclk_clk Serial bus CLK pin 
   */
-  TM1637_CATALEX(PinName mosi, PinName miso, PinName sclk);
+  TM1637_CATALEX(PinName mosi_nc, PinName miso_dio, PinName sclk_clk);
+#endif
 
+ /** Constructor for class for driving TM1637 LED controller
+  *
+  * @brief Supports 4 Digits of 7 Segments + DP (or Colon for Digit2 on some models).
+  *        Also Supports up to 16 Keys. Serial bus interface device. 
+  *
+  *  @param  PinName dio Serial bus DIO pin
+  *  @param  PinName sck Serial bus CLK pin 
+  */
+  TM1637_CATALEX(PinName dio, PinName clk);
+
+  
 #if DOXYGEN_ONLY
     /** Write a character to the Display
      *
@@ -355,7 +403,7 @@
    /** Write Display datablock to TM1637
     *  @param  DisplayData_t data Array of TM1637_DISPLAY_MEM (=4) bytes for displaydata
     *  @param  length number bytes to write (valid range 0..(CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID) (=4), when starting at address 0)  
-    *  @param  int address display memory location to write bytes (default = 0) 
+    *  @param  int address display memory location to write bytes (default = 0)
     *  @return none
     */   
     void writeData(DisplayData_t data, int length = (CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID), int address = 0) {
@@ -376,4 +424,270 @@
 };
 #endif
 
+#if (ROBOTDYN_TEST == 1) 
+// Derived class for TM1637 used in ROBOTDYN 6 Digit display unit
+//
+
+#include "Font_7Seg.h"
+
+#define ROBOTDYN_NR_GRIDS  6
+#define ROBOTDYN_NR_DIGITS 6
+#define ROBOTDYN_NR_UDC    8
+
+
+/** Constructor for class for driving TM1637 controller as used in ROBOTDYN
+  *
+  *  @brief Supports 6 Digits of 7 Segments + DP.
+  *  
+  *  @param  PinName dio Serial bus DIO pin
+  *  @param  PinName clk Serial bus CLK pin 
+  */
+class TM1637_ROBOTDYN : public TM1637, public Stream {
+ public:
+
+  /** Enums for Icons */
+  //  Grid encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+  //  Note that Digits 1,3 and 4,6 are swapped!
+  enum Icon {
+    DP1   = ( 3<<24) | S7_DP1,  /**<  Digit 1 */
+    DP2   = ( 2<<24) | S7_DP2,  /**<  Digit 2 */
+    DP3   = ( 1<<24) | S7_DP3,  /**<  Digit 3 */
+    DP4   = ( 6<<24) | S7_DP4,  /**<  Digit 4 */
+    DP5   = ( 5<<24) | S7_DP5,  /**<  Digit 5 */
+    DP6   = ( 4<<24) | S7_DP6,  /**<  Digit 6 */   
+  };
+  
+  typedef char UDCData_t[ROBOTDYN_NR_UDC];
+
+ /** Constructor for class for driving TM1637 LED controller as used in ROBOTDYN
+   *
+   * @brief Supports 6 Digits of 7 Segments + DP. Also supports up to 16 Keys.
+   *  
+   *  @param  PinName dio Serial bus DIO pin
+   *  @param  PinName clk Serial bus CLK pin 
+  */
+  TM1637_ROBOTDYN(PinName dio, PinName clk);
+
+
+#if DOXYGEN_ONLY
+    /** Write a character to the Display
+     *
+     * @param c The character to write to the display
+     */
+    int putc(int c);
+
+    /** Write a formatted string to the Display
+     *
+     * @param format A printf-style format string, followed by the
+     *               variables to use in formatting the string.
+     */
+    int printf(const char* format, ...);   
+#endif
+
+     /** Locate cursor to a screen column
+     *
+     * @param column  The horizontal position from the left, indexed from 0
+     */
+    void locate(int column);
+    
+    /** Clear the screen and locate to 0
+     * @param bool clrAll Clear Icons also (default = false)
+     */
+    void cls(bool clrAll = false);
+
+    /** Set Icon
+     *
+     * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+     * @return none
+     */
+    void setIcon(Icon icon);
+
+    /** Clr Icon
+     *
+     * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+     * @return none
+     */
+    void clrIcon(Icon icon);
+
+   /** Set User Defined Characters (UDC)
+     *
+     * @param unsigned char udc_idx   The Index of the UDC (0..7)
+     * @param int udc_data            The bitpattern for the UDC (16 bits)       
+     */
+    void setUDC(unsigned char udc_idx, int udc_data);
+
+
+   /** Number of screen columns
+    *
+    * @param none
+    * @return columns
+    */
+    int columns();   
+
+   /** Write databyte to TM1637
+     *  @param  char data byte written at given address
+     *  @param  int address display memory location to write byte
+     *  @return none
+     */ 
+    void writeData(char data, int address){
+      TM1637::writeData(data, address);
+    }        
+
+   /** Write Display datablock to TM1637
+    *  @param  DisplayData_t data Array of TM1637_DISPLAY_MEM (=6) bytes for displaydata
+    *  @param  length number bytes to write (valid range 0..(ROBOTDYN_NR_GRIDS * TM1637_BYTES_PER_GRID) (=6), when starting at address 0)  
+    *  @param  int address display memory location to write bytes (default = 0)
+    *  @return none
+    */   
+    void writeData(DisplayData_t data, int length = (ROBOTDYN_NR_GRIDS * TM1637_BYTES_PER_GRID), int address = 0) {
+      TM1637::writeData(data, length, address);
+    }  
+
+protected:  
+    // Stream implementation functions
+    virtual int _putc(int value);
+    virtual int _getc();
+
+private:
+    int _column;
+    int _columns;   
+    
+    DisplayData_t _displaybuffer;
+    UDCData_t _UDC_7S; 
+};
+#endif
+
+
+#if (EYEWINK_TEST == 1) 
+// Derived class for TM1637 used in EYEWINK 6 Digit + 6 Keys display unit
+//
+
+#include "Font_7Seg.h"
+
+#define EYEWINK_NR_GRIDS  6
+#define EYEWINK_NR_DIGITS 6
+#define EYEWINK_NR_UDC    8
+
+
+/** Constructor for class for driving TM1637 controller as used in EYEWINK
+  *
+  *  @brief Supports 6 Digits of 7 Segments + DP and 6 Keys.
+  *  
+  *  @param  PinName dio Serial bus DIO pin
+  *  @param  PinName clk Serial bus CLK pin 
+  */
+class TM1637_EYEWINK : public TM1637, public Stream {
+ public:
+
+  /** Enums for Icons */
+  //  Grid encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+  enum Icon {
+    DP1   = ( 1<<24) | S7_DP1,  /**<  Digit 1 */
+    DP2   = ( 2<<24) | S7_DP2,  /**<  Digit 2 */
+    DP3   = ( 3<<24) | S7_DP3,  /**<  Digit 3 */
+    DP4   = ( 4<<24) | S7_DP4,  /**<  Digit 4 */
+    DP5   = ( 5<<24) | S7_DP5,  /**<  Digit 5 */
+    DP6   = ( 6<<24) | S7_DP6,  /**<  Digit 6 */   
+  };
+  
+  typedef char UDCData_t[EYEWINK_NR_UDC];
+
+ /** Constructor for class for driving TM1637 LED controller as used in EYEWINK
+   *
+   * @brief Supports 6 Digits of 7 Segments + DP.
+   *  
+   *  @param  PinName dio Serial bus DIO pin
+   *  @param  PinName clk Serial bus CLK pin 
+  */
+  TM1637_EYEWINK(PinName dio, PinName clk);
+
+
+#if DOXYGEN_ONLY
+    /** Write a character to the Display
+     *
+     * @param c The character to write to the display
+     */
+    int putc(int c);
+
+    /** Write a formatted string to the Display
+     *
+     * @param format A printf-style format string, followed by the
+     *               variables to use in formatting the string.
+     */
+    int printf(const char* format, ...);   
+#endif
+
+     /** Locate cursor to a screen column
+     *
+     * @param column  The horizontal position from the left, indexed from 0
+     */
+    void locate(int column);
+    
+    /** Clear the screen and locate to 0
+     * @param bool clrAll Clear Icons also (default = false)
+     */
+    void cls(bool clrAll = false);
+
+    /** Set Icon
+     *
+     * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+     * @return none
+     */
+    void setIcon(Icon icon);
+
+    /** Clr Icon
+     *
+     * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs
+     * @return none
+     */
+    void clrIcon(Icon icon);
+
+   /** Set User Defined Characters (UDC)
+     *
+     * @param unsigned char udc_idx   The Index of the UDC (0..7)
+     * @param int udc_data            The bitpattern for the UDC (16 bits)       
+     */
+    void setUDC(unsigned char udc_idx, int udc_data);
+
+
+   /** Number of screen columns
+    *
+    * @param none
+    * @return columns
+    */
+    int columns();   
+
+   /** Write databyte to TM1637
+     *  @param  char data byte written at given address
+     *  @param  int address display memory location to write byte
+     *  @return none
+     */ 
+    void writeData(char data, int address){
+      TM1637::writeData(data, address);
+    }        
+
+   /** Write Display datablock to TM1637
+    *  @param  DisplayData_t data Array of TM1637_DISPLAY_MEM (=6) bytes for displaydata
+    *  @param  length number bytes to write (valid range 0..(EYEWINK_NR_GRIDS * TM1637_BYTES_PER_GRID) (=6), when starting at address 0)  
+    *  @param  int address display memory location to write bytes (default = 0)
+    *  @return none
+    */   
+    void writeData(DisplayData_t data, int length = (EYEWINK_NR_GRIDS * TM1637_BYTES_PER_GRID), int address = 0) {
+      TM1637::writeData(data, length, address);
+    }  
+
+protected:  
+    // Stream implementation functions
+    virtual int _putc(int value);
+    virtual int _getc();
+
+private:
+    int _column;
+    int _columns;   
+    
+    DisplayData_t _displaybuffer;
+    UDCData_t _UDC_7S; 
+};
+#endif
+
 #endif
\ No newline at end of file
--- a/TM1637_Config.h	Sat Jan 30 20:35:25 2016 +0000
+++ b/TM1637_Config.h	Fri Oct 06 16:43:56 2017 +0000
@@ -1,5 +1,8 @@
 /* mbed TM1637 Library, for TM1637 LEDcontroller
  * Copyright (c) 2016, v01: WH, Initial version
+ *               2017, v02: WH, Added RobotDyn 6 Digit module,
+ *                          Added Eyewink 6 Digit + 6 Keys module, 
+ *                          Constructor adapted to 2 pins: dio, clk 
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -24,10 +27,16 @@
 #define TM1637_CONFIG_H
 
 // Select one of the testboards for TM1637 LED controller
-#define TM1637_TEST  0
-#define CATALEX_TEST 1 
+#define TM1637_TEST   0
+#define CATALEX_TEST  0 
+#define ROBOTDYN_TEST 0 
+#define EYEWINK_TEST  1 
+
+// Select when you wish to keep the DEPRECATED Constructor with 3 Pins for mosi, miso and sclk
+// The new component Constructor uses only 2 pins: dio and clk
+#define SPI           1 
 
 // Select the display mode: only digits and hex or ASCII
-#define SHOW_ASCII   1 
+#define SHOW_ASCII    1 
 
 #endif
\ No newline at end of file