UART to I2C master(s) converter, targetting to emulate SC18IM700(NXP) chip
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
- https://developer.mbed.org/platforms/Switch-Science-mbed-LPC824/
- https://developer.mbed.org/platforms/LPCXpresso824-MAX/
LPC1768
LPC11U35
Quote:
LPC11U35 implement requires importing USBDevice library to use USBSerial class
visit https://github.com/K4zuki/tinyI2C for more information
tinyI2C_1768.h@76:fcbc456010e0, 2016-08-31 (annotated)
- Committer:
- K4zuki
- Date:
- Wed Aug 31 02:39:01 2016 +0900
- Revision:
- 76:fcbc456010e0
- Parent:
- 42:da85c17ea495
Merge branch 'master' of https://@developer.mbed.org/users/k4zuki/code/uart_i2c_conv
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
K4zuki |
76:fcbc456010e0 | 1 | /* |
K4zuki |
76:fcbc456010e0 | 2 | tinyI2C_1768.h |
K4zuki |
76:fcbc456010e0 | 3 | */ |
K4zuki |
76:fcbc456010e0 | 4 | |
K4zuki |
76:fcbc456010e0 | 5 | static const uint8_t chip_id = ID_LPC1768; |
K4zuki |
76:fcbc456010e0 | 6 | |
K4zuki |
76:fcbc456010e0 | 7 | #define isI2C1 // unused(always enabled) |
K4zuki |
76:fcbc456010e0 | 8 | I2C dev1( p9, p10 ); |
K4zuki |
76:fcbc456010e0 | 9 | |
K4zuki |
76:fcbc456010e0 | 10 | #define isI2C2 |
K4zuki |
76:fcbc456010e0 | 11 | I2C dev2(p28, p27); |
K4zuki |
76:fcbc456010e0 | 12 | #undef isI2C3 |
K4zuki |
76:fcbc456010e0 | 13 | #undef isI2C4 |
K4zuki |
76:fcbc456010e0 | 14 | |
K4zuki |
76:fcbc456010e0 | 15 | #define isUART |
K4zuki |
76:fcbc456010e0 | 16 | #undef isUSBUART |
K4zuki |
76:fcbc456010e0 | 17 | Serial pc(USBTX,USBRX); |
K4zuki |
76:fcbc456010e0 | 18 | |
K4zuki |
76:fcbc456010e0 | 19 | #define isHWSPI |
K4zuki |
76:fcbc456010e0 | 20 | #undef isSWSPI |
K4zuki |
76:fcbc456010e0 | 21 | SPI _spi(p5, p6, p7); // mosi, miso, sclk |
K4zuki |
76:fcbc456010e0 | 22 | DigitalOut _cs(p8); // CS |
K4zuki |
76:fcbc456010e0 | 23 | |
K4zuki |
76:fcbc456010e0 | 24 | #define isGPIO0 // unused(always enabled) |
K4zuki |
76:fcbc456010e0 | 25 | DigitalInOut _GPIO00(p11); |
K4zuki |
76:fcbc456010e0 | 26 | DigitalInOut _GPIO01(p12); |
K4zuki |
76:fcbc456010e0 | 27 | DigitalInOut _GPIO02(p13); |
K4zuki |
76:fcbc456010e0 | 28 | DigitalInOut _GPIO03(p14); |
K4zuki |
76:fcbc456010e0 | 29 | DigitalInOut _GPIO04(p15); |
K4zuki |
76:fcbc456010e0 | 30 | DigitalInOut _GPIO05(p16); |
K4zuki |
76:fcbc456010e0 | 31 | DigitalInOut _GPIO06(p17); |
K4zuki |
76:fcbc456010e0 | 32 | DigitalInOut _GPIO07(p18); |
K4zuki |
76:fcbc456010e0 | 33 | |
K4zuki |
76:fcbc456010e0 | 34 | #define isGPIO1 |
K4zuki |
76:fcbc456010e0 | 35 | DigitalInOut _GPIO10(p19); |
K4zuki |
76:fcbc456010e0 | 36 | DigitalInOut _GPIO11(p20); |
K4zuki |
76:fcbc456010e0 | 37 | DigitalInOut _GPIO12(p21); |
K4zuki |
76:fcbc456010e0 | 38 | DigitalInOut _GPIO13(p22); |
K4zuki |
76:fcbc456010e0 | 39 | DigitalInOut _GPIO14(p23); |
K4zuki |
76:fcbc456010e0 | 40 | DigitalInOut _GPIO15(p24); |
K4zuki |
76:fcbc456010e0 | 41 | DigitalInOut _GPIO16(p25); |
K4zuki |
76:fcbc456010e0 | 42 | DigitalInOut _GPIO17(p26); |
K4zuki |
76:fcbc456010e0 | 43 |