UART to I2C master(s) converter, targetting to emulate SC18IM700(NXP) chip

Dependencies:   mbed

UART to I2C master(s) converter, targetting to emulate SC18IM700(NXP) chip

Features

up to 4x I2C master

  • for LPC824 implement, we can use up to 4 channels of I2C masters
    • 1x Fm+ and 3x Fm I2C channels
  • for LPC1768 implement, we can use up to 2 channels of I2C masters
    • 2x Fm I2C channels
  • for LPC11U35 implement, only one channel for I2C master, but program uses USB CDC class for UART communication (means no external USB-Serial converter chip)
    • 1x Fm+ I2C channels

1x SPI master

up to 2x 8bit GPIO

Tested Platforms

LPC824

LPC1768

LPC11U35

Quote:

LPC11U35 implement requires importing USBDevice library to use USBSerial class

visit https://github.com/K4zuki/tinyI2C for more information

Revision:
42:da85c17ea495
Child:
76:fcbc456010e0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tinyI2C_824.h	Tue Aug 30 16:30:55 2016 +0000
@@ -0,0 +1,53 @@
+/*
+tinyI2C_824.h
+*/
+
+static const uint8_t chip_id = ID_LPC824;
+#define isI2C1  // unused(always enabled)
+I2C dev1(I2C_SDA, I2C_SCL);//11,10 hard coded, 220 ohm pull-up
+
+#define isI2C2
+#define isI2C3
+#define isI2C4
+
+#define isUART
+#undef isUSBUART
+
+#define isHWSPI
+#undef isSWSPI
+
+#define isGPIO0 // unused(always enabled)
+#undef isGPIO1
+
+#if defined(TARGET_SSCI824)
+    Serial pc(P0_4, P0_0);
+    I2C dev2(P0_16, P0_27);
+    I2C dev3(P0_26, P0_25);
+    I2C dev4(P0_24, P0_15);
+    SPI _spi(P0_6, P0_7, P0_13); // mosi, miso, sclk
+    DigitalOut _cs(P0_1); // CS
+    DigitalInOut _GPIO00(P0_17);
+    DigitalInOut _GPIO01(P0_18);
+    DigitalInOut _GPIO02(P0_19);
+    DigitalInOut _GPIO03(P0_20);
+    DigitalInOut _GPIO04(P0_21);
+    DigitalInOut _GPIO05(P0_22);
+    DigitalInOut _GPIO06(P0_23);
+    DigitalInOut _GPIO07(P0_14);
+#elif defined(TARGET_LPC824)
+    Serial pc(USBTX,USBRX); // P0_7, P0_18
+    I2C dev2(P0_6, P0_14); // 6,14 | A0, A1
+    I2C dev3(P0_23, P0_22); // 23,22 | A2, A3
+    I2C dev4(P0_21, P0_20); // 21,20 | A4, A5
+    SPI _spi(P0_26,P0_25,P0_24); // mosi, miso, sclk, D11, D12, D13
+    DigitalOut _cs(P0_15); // CS, D10
+    DigitalInOut _GPIO00(P0_19); // D2
+    DigitalInOut _GPIO01(P0_12); // D3
+    DigitalInOut _GPIO02(P0_18); // D4
+    DigitalInOut _GPIO03(P0_28); // D5
+    DigitalInOut _GPIO04(P0_16); // D6
+    DigitalInOut _GPIO05(P0_17); // D7
+    DigitalInOut _GPIO06(P0_13); // D8
+    DigitalInOut _GPIO07(P0_27); // D9
+#endif
+