RETRO ROBOT E

Dependents:   RETRO_ROBOT_SC16IS750E

Fork of SC16IS750 by Wim Huiskamp

Files at this revision

API Documentation at this revision

Comitter:
wim
Date:
Mon Dec 22 19:04:38 2014 +0000
Parent:
3:9783b6bde958
Child:
5:ff3e57bebb6a
Commit message:
Added support for SC16IS752 Dual UART device.

Changed in this revision

SC16IS750.cpp Show annotated file Show diff for this revision Revisions of this file
SC16IS750.h Show annotated file Show diff for this revision Revisions of this file
--- a/SC16IS750.cpp	Thu Feb 20 19:37:55 2014 +0000
+++ b/SC16IS750.cpp	Mon Dec 22 19:04:38 2014 +0000
@@ -1,6 +1,8 @@
 /* SC16IS750 I2C or SPI to UART bridge 
  *   v0.1 WH, Nov 2013, Sparkfun WiFly Shield code library alpha 0 used as example, Added I2C I/F and many more methods.
  *                      https://forum.sparkfun.com/viewtopic.php?f=13&t=21846
+ *   v0.2 WH, Feb 2014, Added Doxygen Documentation, Added Hardware Reset pin methods. 
+ *   v0.3 WH, Dec 2014, Added support for SC16IS752 dual UART.  
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
  * and associated documentation files (the "Software"), to deal in the Software without restriction,
@@ -231,9 +233,12 @@
 
   // Initialise SC16IS750
 
+  // Hardware reset, assuming there is a HW Reset pin
+//  this->hwReset();  
+
   // Software reset, assuming there is no access to the HW Reset pin
   swReset();
-
+  
   // Set default baudrate (depends on prescaler) and save in _config
   // DLL/DLH  
   baud();
@@ -626,19 +631,33 @@
 
 
 
-/** Class SC16IS750_SPI for a converter between SPI and a Serial port
-  *
-  * @code
+//
+// Begin SPI Class Implementation
+//
+
+
+/** Create an SC16IS750_SPI object using a specified SPI bus and CS
   *
-  * @endcode
-  *
-  */
-SC16IS750_SPI::SC16IS750_SPI (SPI *spi, PinName cs) : _spi(spi), _cs(cs)  {
+  * @param SPI &spi the SPI port to connect to 
+  * @param cs  Pinname of the CS pin (active low)
+  * @param rst Pinname for Reset pin (active low) Optional, Default = NC 
+  */    
+SC16IS750_SPI::SC16IS750_SPI (SPI *spi, PinName cs, PinName rst) : _spi(spi), _cs(cs)  {
   _cs = 1;  // deselect
   
   _spi->format(8, 0);          
   _spi->frequency(1000000);
-//  _spi->frequency(100000);  //test
+
+  // The hardware Reset pin is optional. Test and make sure whether it exists or not to prevent illegal access.
+  if (rst != NC) {
+    _reset = new DigitalOut(rst);   //Construct new pin 
+    _reset->write(1);               //Deactivate    
+  }
+  else {
+    // No Hardware Reset pin       
+    _reset = NULL;                  //Construct dummy pin     
+  }  
+
 
   // Dont call _init() until SPI port has been configured.
   // That is why _init() is not called in parent Constructor 
@@ -646,6 +665,19 @@
 
 };
 
+
+/** Destruct SC16IS750_SPI bridge object
+  *
+  * @param  none
+  * @return none
+  */ 
+SC16IS750_SPI::~SC16IS750_SPI() {
+   if (_reset != NULL) {delete _reset;}  // Reset pin
+}
+
+
+
+
 /** Write value to internal register.
   * Pure virtual, must be declared in derived class.   
   *   @param registerAddress   The address of the Register (enum RegisterName)
@@ -659,7 +691,6 @@
   _spi->write(data);
   _cs = 1; //  deselect;
 
-
 }
 
 
@@ -706,28 +737,73 @@
   _cs = 1; //  deselect;
 }
 
+
+/** Hardware Reset SC16IS750 device.
+  * This method is only available when the Reset pin has been declared and is also connected
+  *   @param  none
+  *   @return none
+  */
+void SC16IS750_SPI::hwReset() {
+  
+  if (_reset != NULL){
+    _reset->write(0);  //activate
+//    wait_ms(100);
+    wait_ms(1000);   //test only            
+    _reset->write(1);  //deactivate
+  }  
+  else {
+    printf("Hardware Reset pin is not available...\n\r");     
+  }
+
+}
+
 //
 // End SPI Implementation
 //
 
 
-/** Class SC16IS750_I2C for a converter between I2C and a Serial port
-  *
-  * @code
+
+//
+// Begin I2C Implementation
+//
+
+/** Create a SC16IS750_I2C object for a bridge between I2C and a Serial port
   *
-  * @endcode
-  *
-  */
-SC16IS750_I2C::SC16IS750_I2C(I2C *i2c, uint8_t deviceAddress) : _i2c(i2c), _slaveAddress(deviceAddress & 0xFE) {
+  * @param I2C &i2c the I2C port to connect to 
+  * @param char deviceAddress the I2C slave address of the SC16IS750
+  * @param rst Pinname for Reset pin (active low) Optional, Default = NC   
+  *  
+  */  
+SC16IS750_I2C::SC16IS750_I2C(I2C *i2c, uint8_t deviceAddress, PinName rst) : _i2c(i2c), _slaveAddress(deviceAddress & 0xFE) {
 
   _i2c->frequency(400000);
-
+ 
+  // The hardware Reset pin is optional. Test and make sure whether it exists or not to prevent illegal access.
+  if (rst != NC) {
+    _reset = new DigitalOut(rst);   //Construct new pin 
+    _reset->write(1);               //Deactivate    
+  }
+  else {
+    // No Hardware Reset pin       
+    _reset = NULL;                  //Construct dummy pin     
+  }  
+  
   // Dont call _init() until I2C port has been configured.
   // That is why _init() is not called in parent Constructor 
   _init();
 }
 
 
+/** Destruct SC16IS750_I2C bridge object
+  *
+  * @param  none
+  * @return none
+  */ 
+SC16IS750_I2C::~SC16IS750_I2C() {
+   if (_reset != NULL) {delete _reset;}  // Reset pin
+}
+
+
 /** Write value to internal register.
   *   @param registerAddress   The address of the Register (enum RegisterName)
   *   @param data              The 8bit value to write
@@ -805,6 +881,304 @@
 }
 
 
+/** Hardware Reset SC16IS750 device.
+  * This method is only available when the Reset pin has been declared and is also connected
+  *   @param  none
+  *   @return none
+  */
+void SC16IS750_I2C::hwReset() {
+  
+  if (_reset != NULL){
+    _reset->write(0);  //activate
+//    wait_ms(100);
+    wait_ms(1000);   //test only            
+    _reset->write(1);  //deactivate
+  }  
+  else {
+    printf("Hardware Reset pin is not available...\n\r");     
+  }
+}
+
+
 //
 // End I2C Implementation
-//
\ No newline at end of file
+//
+
+
+
+//
+// Begin SPI Class Implementation for 16SCIS752 dual UART
+//
+
+
+/** Create an SC16IS752_SPI object using a specified SPI bus and CS
+  *
+  * @param SPI &spi the SPI port to connect to 
+  * @param cs  Pinname of the CS pin (active low)
+  * @param rst Pinname for Reset pin (active low) Optional, Default = NC 
+  * @param channel UART ChannelName, Default = Channel_A      
+  */    
+SC16IS752_SPI::SC16IS752_SPI (SPI *spi, PinName cs, PinName rst, ChannelName channel) : _spi(spi), _cs(cs), _channel(channel)  {
+  _cs = 1;  // deselect
+  
+  _spi->format(8, 0);          
+  _spi->frequency(1000000);
+
+  // The hardware Reset pin is optional. Test and make sure whether it exists or not to prevent illegal access.
+  if (rst != NC) {
+    _reset = new DigitalOut(rst);   //Construct new pin 
+    _reset->write(1);               //Deactivate    
+  }
+  else {
+    // No Hardware Reset pin       
+    _reset = NULL;                  //Construct dummy pin     
+  }  
+
+
+  // Dont call _init() until SPI port has been configured.
+  // That is why _init() is not called in parent Constructor 
+  _init();
+
+};
+
+
+/** Destruct SC16IS750_SPI bridge object
+  *
+  * @param  none
+  * @return none
+  */ 
+SC16IS752_SPI::~SC16IS752_SPI() {
+   if (_reset != NULL) {delete _reset;}  // Reset pin
+}
+
+
+
+
+/** Write value to internal register.
+  * Pure virtual, must be declared in derived class.   
+  *   @param registerAddress   The address of the Register (enum RegisterName)
+  *   @param data              The 8bit value to write
+  *   @return none 
+  */
+void SC16IS752_SPI::writeRegister(RegisterName registerAddress, char data) {
+
+  _cs = 0; //  select;
+  _spi->write(registerAddress | _channel);
+  _spi->write(data);
+  _cs = 1; //  deselect;
+
+}
+
+
+/** Read value from internal register.
+  *   @param registerAddress   The address of the Register (enum RegisterName)
+  *   @return char             The 8bit value read from the register
+  */
+char SC16IS752_SPI::readRegister(RegisterName registerAddress) {
+
+  // Used in SPI read operations to flush slave's shift register
+  const char SPI_DUMMY_CHAR = 0xFF; 
+
+  char result;
+
+  _cs = 0; //  select;
+  _spi->write(SPI_READ_MODE_FLAG | registerAddress | _channel);
+  result = _spi->write(SPI_DUMMY_CHAR);
+  _cs = 1; //  deselect;
+
+  return result;  
+}
+
+
+/** Write multiple datavalues to Transmitregister.
+  * More Efficient implementation than writing individual bytes
+  * Assume that previous check confirmed that the FIFO has sufficient free space to store the data  
+  * Pure virtual, must be declared in derived class.   
+  *   @param char* databytes   The pointer to the block of data
+  *   @param len               The number of bytes to write
+  *   @return none 
+  */
+void SC16IS752_SPI::writeDataBlock (const char *data, int len) {
+  int i;
+  
+  _cs = 0; //  select;
+  
+  // Select the Transmit Holding Register
+  // Assume that previous check confirmed that the FIFO has sufficient free space to store the data
+  _spi->write(THR | _channel);
+  
+  for (i=0; i<len; i++, data++)
+    _spi->write(*data);
+    
+  _cs = 1; //  deselect;
+}
+
+
+/** Hardware Reset SC16IS752 device.
+  * This method is only available when the Reset pin has been declared and is also connected
+  *   @param  none
+  *   @return none
+  */
+void SC16IS752_SPI::hwReset() {
+  
+  if (_reset != NULL){
+    _reset->write(0);  //activate
+//    wait_ms(100);
+    wait_ms(1000);   //test only            
+    _reset->write(1);  //deactivate
+  }  
+  else {
+    printf("Hardware Reset pin is not available...\n\r");     
+  }
+
+}
+
+//
+// End SPI Implementation
+//
+
+
+
+//
+// Begin I2C Implementation for 16SCIS752 dual UART
+//
+
+/** Create a SC16IS752_I2C object for a bridge between I2C and a Serial port
+  *
+  * @param I2C &i2c the I2C port to connect to 
+  * @param char deviceAddress the I2C slave address of the SC16IS750
+  * @param rst Pinname for Reset pin (active low) Optional, Default = NC   
+  * @param channel UART Channel, Default = Channel_A    
+  */  
+SC16IS752_I2C::SC16IS752_I2C(I2C *i2c, uint8_t deviceAddress, PinName rst, ChannelName channel) : _i2c(i2c), _slaveAddress(deviceAddress & 0xFE), _channel(channel) {
+
+  _i2c->frequency(400000);
+ 
+  // The hardware Reset pin is optional. Test and make sure whether it exists or not to prevent illegal access.
+  if (rst != NC) {
+    _reset = new DigitalOut(rst);   //Construct new pin 
+    _reset->write(1);               //Deactivate    
+  }
+  else {
+    // No Hardware Reset pin       
+    _reset = NULL;                  //Construct dummy pin     
+  }  
+  
+  // Dont call _init() until I2C port has been configured.
+  // That is why _init() is not called in parent Constructor 
+  _init();
+}
+
+
+/** Destruct SC16IS752_I2C bridge object
+  *
+  * @param  none
+  * @return none
+  */ 
+SC16IS752_I2C::~SC16IS752_I2C() {
+   if (_reset != NULL) {delete _reset;}  // Reset pin
+}
+
+
+/** Write value to internal register.
+  *   @param registerAddress   The address of the Register (enum RegisterName)
+  *   @param data              The 8bit value to write
+  *   @return none 
+  */
+void SC16IS752_I2C::writeRegister(RegisterName registerAddress, char data) {
+  char w[2];
+
+  w[0] = registerAddress | _channel;
+  w[1] = data;
+
+  _i2c->write( _slaveAddress, w, 2 );
+}
+
+
+/** Read value from internal register.
+  *   @param registerAddress   The address of the Register (enum RegisterName)
+  *   @return char             The 8bit value read from the register
+  */
+char SC16IS752_I2C::readRegister(RegisterName registerAddress) {
+  /*
+   * Read char from SC16IS752 register at <registerAddress>.
+   */
+   char w[1];
+   char r[1];
+    
+   w[0] = registerAddress | _channel;
+    
+   _i2c->write( _slaveAddress, w, 1 );
+   _i2c->read( _slaveAddress, r, 1 );
+
+   return ( r[0] );
+}
+
+
+/** Write multiple datavalues to Transmitregister.
+  * More Efficient implementation than writing individual bytes
+  * Assume that previous check confirmed that the FIFO has sufficient free space to store the data
+  * Pure virtual, must be declared in derived class.   
+  *   @param char* databytes   The pointer to the block of data
+  *   @param len               The number of bytes to write
+  *   @return none 
+  */
+void SC16IS752_I2C::writeDataBlock (const char *data, int len) {
+  
+#if(0)  
+  int i;
+  char w[BULK_BLOCK_LEN];
+  
+  // Select the Transmit Holding Register
+  // Assume that previous check confirmed that the FIFO has sufficient free space to store the data
+  w[0] = THR | _channel;
+
+  // copy the data..
+  for (i=0; i<len; i++)
+    w[i+1] = data[i];
+    
+  _i2c->write( _slaveAddress, w, len + 1);  
+#else
+  int i;
+  
+  _i2c->start();
+  _i2c->write(_slaveAddress); 
+
+  // Select the Transmit Holding Register
+  // Assume that previous check confirmed that the FIFO has sufficient free space to store the data
+  _i2c->write(THR | _channel);
+
+  // send the data..
+  for (i=0; i<len; i++)
+    _i2c->write(data[i]);
+    
+  _i2c->stop();  
+#endif
+}
+
+
+/** Hardware Reset SC16IS752 device.
+  * This method is only available when the Reset pin has been declared and is also connected
+  *   @param  none
+  *   @return none
+  */
+void SC16IS752_I2C::hwReset() {
+  
+  if (_reset != NULL){
+    _reset->write(0);  //activate
+//    wait_ms(100);
+    wait_ms(1000);   //test only            
+    _reset->write(1);  //deactivate
+  }  
+  else {
+    printf("Hardware Reset pin is not available...\n\r");     
+  }
+}
+
+
+//
+// End I2C Implementation
+//
+
+
+
--- a/SC16IS750.h	Thu Feb 20 19:37:55 2014 +0000
+++ b/SC16IS750.h	Mon Dec 22 19:04:38 2014 +0000
@@ -1,6 +1,8 @@
 /* SC16IS750 I2C or SPI to UART bridge 
  *   v0.1 WH, Nov 2013, Sparkfun WiFly Shield code library alpha 0 used as example, Added I2C I/F and many more methods.
  *                      https://forum.sparkfun.com/viewtopic.php?f=13&t=21846
+ *   v0.2 WH, Feb 2014, Added Doxygen Documentation, Added Hardware Reset pin methods.
+ *   v0.3 WH, Dec 2014, Added support for SC16IS752 dual UART. 
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
  * and associated documentation files (the "Software"), to deal in the Software without restriction,
@@ -270,7 +272,7 @@
 #define SPI_READ_MODE_FLAG              (0x80)
 
 
-/** Abstract class SC16IS750 for a converter between either SPI or I2C and a Serial port
+/** Abstract class SC16IS750 for a bridge between either SPI or I2C and a Serial port
   *
   * Supports both SPI and I2C interfaces through derived classes
   *
@@ -365,6 +367,11 @@
         RTSCTS
     };
  
+//  SC16IS752 Channel definitions (shifted to align)
+    enum ChannelName { 
+      Channel_A     = 0x00 << 1,   
+      Channel_B     = 0x01 << 1         
+    };
   
 // SC16IS750 configuration register values
 // Several configuration registers are write-only. Need to save values to allow restoring.
@@ -407,7 +414,6 @@
   */  
   int writableCount();
 
-
 /**
   * Read char from UART Bridge.
   * Acts in the same manner as 'Serial.read()'.  
@@ -421,7 +427,17 @@
   *   @param value char to be written    
   *   @return value written  
   */
-  int putc(int value);    
+  int putc(int c);
+ 
+
+#if DOXYGEN_ONLY
+  /** Write a formatted string to the UART Bridge. Blocking when no free space in FIFO
+    *
+    * @param format A printf-style format string, followed by the
+    *               variables to use in formatting the string.
+    */
+   int printf(const char* format, ...);
+#endif
 
 
 /**
@@ -580,6 +596,14 @@
   void swReset();
 
 
+/** Hardware Reset SC16IS750 device.
+  * Pure virtual, must be declared in derived class.   
+  * This method is only functional when the Reset pin has been declared and is also connected
+  *   @param  none
+  *   @return none
+  */
+  virtual void hwReset() =0;
+
 /** Write value to internal register.
   * Pure virtual, must be declared in derived class.   
   *   @param registerAddress   The address of the Register (enum RegisterName)
@@ -648,6 +672,7 @@
   *
   */
   virtual int peek() {return 0;};
+  
 
 // Save config settings
 SC16IS750_cfg _config;
@@ -659,7 +684,7 @@
 
 
 
-/** Class SC16IS750_SPI for a converter between SPI and a Serial port
+/** Class SC16IS750_SPI for a bridge between SPI and a Serial port
  *
  * @code
  * #include "mbed.h"
@@ -688,12 +713,21 @@
 class SC16IS750_SPI : public SC16IS750 {
 public:
 
-/** Create a SC16IS750_SPI object using a specified SPI bus and CS
+/** Create an SC16IS750_SPI object using a specified SPI bus and CS
   *
   * @param SPI &spi the SPI port to connect to 
-  * @param cs  the Pin of the CS
+  * @param cs  Pinname of the CS pin (active low)
+  * @param rst Pinname for Reset pin (active low) Optional, Default = NC 
   */  
-  SC16IS750_SPI(SPI *spi, PinName cs);
+  SC16IS750_SPI(SPI *spi, PinName cs, PinName rst = NC);
+
+/** Destruct SC16IS750_SPI bridge object
+  *
+  * @param  none
+  * @return none
+  */ 
+  virtual ~SC16IS750_SPI();
+
 
 /** Write value to internal register.
   *   @param registerAddress   The address of the Register (enum RegisterName)
@@ -711,13 +745,20 @@
 /** Write multiple datavalues to Transmitregister.
   * More Efficient implementation than writing individual bytes
   * Assume that previous check confirmed that the FIFO has sufficient free space to store the data 
-  * Pure virtual, must be declared in derived class.   
+  * 
   *   @param char* databytes   The pointer to the block of data
   *   @param len               The number of bytes to write
   *   @return none 
   */
   virtual void writeDataBlock (const char *data, int len );
 
+/** Hardware Reset SC16IS750 device.
+  * This method is only functional when the Reset pin has been declared and is also connected
+  *   @param  none
+  *   @return none
+  */
+  virtual void hwReset();
+
 
 protected:
 //protected is accessible to derived classes, but not to external users
@@ -725,13 +766,18 @@
 
 private:
   SPI *_spi;          //SPI bus reference
-  DigitalOut _cs;     //CS of SPI device
+  DigitalOut _cs;     //CS of SPI device (active low)
+
+/** Optional Hardware Reset pin for the bridge device (active low)
+  * Default PinName value is NC
+  */
+  DigitalOut* _reset; //Reset the Bridge device (active low)
 
 };
 
 
 
-/** Class SC16IS750_I2C for a converter between I2C and a Serial port
+/** Class SC16IS750_I2C for a bridge between I2C and a Serial port
  *
  * @code
  * #include "mbed.h"
@@ -760,12 +806,22 @@
 class SC16IS750_I2C : public SC16IS750 {
 public:
 
-/** Create a SC16IS750_I2C object using a specified I2C bus and slaveaddress
+/** Create an SC16IS750_I2C object using a specified I2C bus and slaveaddress
   *
   * @param I2C &i2c the I2C port to connect to 
   * @param char deviceAddress the address of the SC16IS750
+  * @param rst Pinname for Reset pin (active low) Optional, Default = NC   
   */  
-  SC16IS750_I2C(I2C *i2c, uint8_t deviceAddress = SC16IS750_DEFAULT_ADDR);
+  SC16IS750_I2C(I2C *i2c, uint8_t deviceAddress = SC16IS750_DEFAULT_ADDR, PinName rst = NC);
+
+
+/** Destruct SC16IS750_I2C bridge object
+  *
+  * @param  none
+  * @return none
+  */ 
+  virtual ~SC16IS750_I2C();
+
 
 /** Write value to internal register.
   *   @param registerAddress   The address of the Register (enum RegisterName)
@@ -791,6 +847,15 @@
   */
   virtual void writeDataBlock (const char *data, int len );
 
+
+/** Hardware Reset SC16IS750 device.
+  * This method is only functional when the Reset pin has been declared and is also connected
+  *   @param  none
+  *   @return none
+  */
+  virtual void hwReset();
+
+
 protected:
 //protected is accessible to derived classes, but not to external users
 
@@ -798,7 +863,209 @@
 private:
   I2C *_i2c;                    //I2C bus reference
   uint8_t _slaveAddress;        //I2C Slave address of device
-    
+
+/** Optional Hardware Reset pin for the bridge device (active low)
+  * Default PinName value is NC
+  */
+  DigitalOut* _reset;           //Reset the Bridge device (active low)
+
+};
+
+
+
+/** Class SC16IS752_SPI for a bridge between SPI and a Serial port
+ *
+ * @code
+ * #include "mbed.h"
+ * #include "SC16IS750.h"
+ *
+ * SPI spi(PTD2, PTD3, PTD1); //MOSI, MISO, SCK
+ * SC16IS750_SPI serial_spi(&spi, PTD0, NC, SC16IS750::Channel_B);
+ * 
+ * Serial pc(USBTX,USBRX);
+ *
+ * int main() {
+ *   pc.printf("\nHello World!\n");
+ *
+ *   while(1) { 
+ *     serial_spi.ioSetState(0x00);
+ *     wait(0.5);
+ *     serial_spi.ioSetState(0xFF); 
+ *     wait(0.5); 
+ *     serial_spi.putc('*');  
+ *     pc.putc('*');                
+ *   }
+ * }
+ *
+ * @endcode
+ */
+class SC16IS752_SPI : public SC16IS750 {
+public:
+
+/** Create an SC16IS752_SPI object using a specified SPI bus and CS
+  *
+  * @param SPI &spi the SPI port to connect to 
+  * @param cs  Pinname of the CS pin (active low)
+  * @param rst Pinname for Reset pin (active low) Optional, Default = NC 
+  * @param channel UART ChannelName, Default = Channel_A    
+  */  
+  SC16IS752_SPI(SPI *spi, PinName cs, PinName rst = NC, ChannelName channel = SC16IS750::Channel_A );
+
+/** Destruct SC16IS752_SPI bridge object
+  *
+  * @param  none
+  * @return none
+  */ 
+  virtual ~SC16IS752_SPI();
+
+
+/** Write value to internal register.
+  *   @param registerAddress   The address of the Register (enum RegisterName)
+  *   @param data              The 8bit value to write
+  *   @return none 
+  */
+  virtual void writeRegister(SC16IS750::RegisterName registerAddress, char data);
+
+/** Read value from internal register.
+  *   @param registerAddress   The address of the Register (enum RegisterName)
+  *   @return char             The 8bit value read from the register
+  */
+  virtual char readRegister(SC16IS750::RegisterName registerAddress);
+
+/** Write multiple datavalues to Transmitregister.
+  * More Efficient implementation than writing individual bytes
+  * Assume that previous check confirmed that the FIFO has sufficient free space to store the data 
+  * 
+  *   @param char* databytes   The pointer to the block of data
+  *   @param len               The number of bytes to write
+  *   @return none 
+  */
+  virtual void writeDataBlock (const char *data, int len );
+
+/** Hardware Reset SC16IS750 device.
+  * This method is only functional when the Reset pin has been declared and is also connected
+  *   @param  none
+  *   @return none
+  */
+  virtual void hwReset();
+
+
+protected:
+//protected is accessible to derived classes, but not to external users
+
+
+private:
+  SPI *_spi;          //SPI bus reference
+  DigitalOut _cs;     //CS of SPI device (active low)
+
+/** Optional Hardware Reset pin for the bridge device (active low)
+  * Default PinName value is NC
+  */
+  DigitalOut* _reset; //Reset the Bridge device (active low)
+
+// Save Channel setting
+  ChannelName _channel; 
+
+};
+
+
+
+/** Class SC16IS752_I2C for a bridge between I2C and a Serial port
+ *
+ * @code
+ * #include "mbed.h"
+ * #include "SC16IS750.h"
+ *
+ * I2C i2c(PTE0, PTE1);       //SDA, SCL
+ * SC16IS752_I2C serial_i2c(&i2c, DEFAULT_SC16IS750_ADDR, NC, SC16IS750::Channel_A);
+ *
+ * Serial pc(USBTX,USBRX);
+ *
+ * int main() {
+ *   pc.printf("\nHello World!\n");
+ *
+ *   while(1) { 
+ *     serial_i2c.ioSetState(0x00);
+ *     wait(0.5);
+ *     serial_i2c.ioSetState(0xFF); 
+ *     wait(0.5); 
+ *     serial_i2c.putc('*');   
+ *     pc.putc('*');                
+ *   }
+ * }
+ *
+ * @endcode
+ */
+class SC16IS752_I2C : public SC16IS750 {
+public:
+
+/** Create an SC16IS752_I2C object using a specified I2C bus, slaveaddress and Channel
+  *
+  * @param I2C &i2c the I2C port to connect to 
+  * @param char deviceAddress the address of the SC16IS750
+  * @param rst Pinname for Reset pin (active low) Optional, Default = NC
+  * @param channel UART ChannelName, Default = Channel_A  
+  */  
+  SC16IS752_I2C(I2C *i2c, uint8_t deviceAddress = SC16IS750_DEFAULT_ADDR, PinName rst = NC, ChannelName channel = SC16IS750::Channel_A);
+
+
+/** Destruct SC16IS752_I2C bridge object
+  *
+  * @param  none
+  * @return none
+  */ 
+  virtual ~SC16IS752_I2C();
+
+
+/** Write value to internal register.
+  *   @param registerAddress   The address of the Register (enum RegisterName)
+  *   @param data              The 8bit value to write
+  *   @return none 
+  */
+  virtual void writeRegister(SC16IS750::RegisterName register_address, char data );
+
+/** Read value from internal register.
+  *   @param registerAddress   The address of the Register (enum RegisterName)
+  *   @return char             The 8bit value read from the register
+  */
+  virtual char readRegister(SC16IS750::RegisterName register_address );
+
+
+/** Write multiple datavalues to Transmitregister.
+  * More Efficient implementation than writing individual bytes
+  * Assume that previous check confirmed that the FIFO has sufficient free space to store the data 
+  * Pure virtual, must be declared in derived class.   
+  *   @param char* databytes   The pointer to the block of data
+  *   @param len               The number of bytes to write
+  *   @return none 
+  */
+  virtual void writeDataBlock (const char *data, int len );
+
+
+/** Hardware Reset SC16IS752 device.
+  * This method is only functional when the Reset pin has been declared and is also connected
+  *   @param  none
+  *   @return none
+  */
+  virtual void hwReset();
+
+
+protected:
+//protected is accessible to derived classes, but not to external users
+
+
+private:
+  I2C *_i2c;                    //I2C bus reference
+  uint8_t _slaveAddress;        //I2C Slave address of device
+
+/** Optional Hardware Reset pin for the bridge device (active low)
+  * Default PinName value is NC
+  */
+  DigitalOut* _reset;           //Reset the Bridge device (active low)
+
+// Save Channel setting
+  ChannelName _channel; 
+
 };