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

Committer:
K4zuki
Date:
Mon Sep 19 17:56:32 2016 +0900
Revision:
85:4b1489cd5623
Parent:
82:159258b3b099
fix indents

Who changed what in which revision?

UserRevisionLine numberNew contents of line
K4zuki 78:434514b8d383 1 /*
K4zuki 78:434514b8d383 2 tinyI2C_824.h
K4zuki 78:434514b8d383 3 */
K4zuki 78:434514b8d383 4
K4zuki 78:434514b8d383 5 static const uint8_t chip_id = ID_LPC824;
K4zuki 78:434514b8d383 6 #define isI2C1 // unused(always enabled)
K4zuki 78:434514b8d383 7 I2C dev1(I2C_SDA, I2C_SCL);//11,10 hard coded, 220 ohm pull-up
K4zuki 78:434514b8d383 8
K4zuki 78:434514b8d383 9 #define isI2C2
K4zuki 78:434514b8d383 10 #define isI2C3
K4zuki 78:434514b8d383 11 #define isI2C4
K4zuki 78:434514b8d383 12
K4zuki 78:434514b8d383 13 #define isUART
K4zuki 78:434514b8d383 14 #undef isUSBUART
K4zuki 82:159258b3b099 15 Serial pc(USBTX, USBRX); // P0_7, P0_18
K4zuki 78:434514b8d383 16
K4zuki 78:434514b8d383 17 #define isHWSPI
K4zuki 78:434514b8d383 18 #undef isSWSPI
K4zuki 78:434514b8d383 19
K4zuki 78:434514b8d383 20 #define isGPIO0 // unused(always enabled)
K4zuki 78:434514b8d383 21 #undef isGPIO1
K4zuki 78:434514b8d383 22
K4zuki 78:434514b8d383 23 #if defined(TARGET_SSCI824)
K4zuki 78:434514b8d383 24 I2C dev2(P0_16, P0_27);
K4zuki 78:434514b8d383 25 I2C dev3(P0_26, P0_25);
K4zuki 78:434514b8d383 26 I2C dev4(P0_24, P0_15);
K4zuki 78:434514b8d383 27 DigitalOut _cs(P0_1); // CS
K4zuki 82:159258b3b099 28 SPI _spi(P0_14, P0_0, P0_6); // mosi, miso, sclk
K4zuki 82:159258b3b099 29 DigitalInOut _GPIO00(P0_23);
K4zuki 82:159258b3b099 30 DigitalInOut _GPIO01(P0_22);
K4zuki 82:159258b3b099 31 DigitalInOut _GPIO02(P0_21);
K4zuki 78:434514b8d383 32 DigitalInOut _GPIO03(P0_20);
K4zuki 82:159258b3b099 33 DigitalInOut _GPIO04(P0_19);
K4zuki 82:159258b3b099 34 DigitalInOut _GPIO05(P0_17);
K4zuki 82:159258b3b099 35 DigitalInOut _GPIO06(P0_13);
K4zuki 82:159258b3b099 36 DigitalInOut _GPIO07(P0_12);
K4zuki 78:434514b8d383 37 #elif defined(TARGET_LPC824)
K4zuki 78:434514b8d383 38 I2C dev2(P0_6, P0_14); // 6,14 | A0, A1
K4zuki 78:434514b8d383 39 I2C dev3(P0_23, P0_22); // 23,22 | A2, A3
K4zuki 78:434514b8d383 40 I2C dev4(P0_21, P0_20); // 21,20 | A4, A5
K4zuki 82:159258b3b099 41 SPI _spi(P0_26, P0_25, P0_24); // mosi, miso, sclk, D11, D12, D13
K4zuki 78:434514b8d383 42 DigitalOut _cs(P0_15); // CS, D10
K4zuki 78:434514b8d383 43 DigitalInOut _GPIO00(P0_19); // D2
K4zuki 78:434514b8d383 44 DigitalInOut _GPIO01(P0_12); // D3
K4zuki 78:434514b8d383 45 DigitalInOut _GPIO02(P0_18); // D4
K4zuki 78:434514b8d383 46 DigitalInOut _GPIO03(P0_28); // D5
K4zuki 78:434514b8d383 47 DigitalInOut _GPIO04(P0_16); // D6
K4zuki 78:434514b8d383 48 DigitalInOut _GPIO05(P0_17); // D7
K4zuki 78:434514b8d383 49 DigitalInOut _GPIO06(P0_13); // D8
K4zuki 78:434514b8d383 50 DigitalInOut _GPIO07(P0_27); // D9
K4zuki 78:434514b8d383 51 #endif