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
Diff: main.cpp
- Revision:
- 83:f10af47696bb
- Parent:
- 80:3cbe7972872b
- Child:
- 84:394b8cc7bef2
--- a/main.cpp Mon Sep 05 00:48:29 2016 +0900 +++ b/main.cpp Mon Sep 12 01:01:23 2016 +0900 @@ -625,53 +625,53 @@ // pc.printf("s%04X,",_data); send[(j/2)+0] = 0xFF & (ack>>8); send[(j/2)+1] = 0xFF & (ack>>0); + } + for(int j = length; j < (length+2*read); j += 4){ + ack = _spi.write(0xAAAA); //dummy data to write + // pc.printf("a%04X,",ack); + send[(j/2)+0] = 0xFF & (ack>>8); + send[(j/2)+1] = 0xFF & (ack>>0); + } + _cs.write(disabled); } - for(int j = length; j < (length+2*read); j += 4){ - ack = _spi.write(0xAAAA); //dummy data to write - // pc.printf("a%04X,",ack); - send[(j/2)+0] = 0xFF & (ack>>8); - send[(j/2)+1] = 0xFF & (ack>>0); - } - _cs.write(disabled); + break; } - break; - } default: { pc.printf("this shold not happen %d\n\r",format); break; } } - // pc.printf("command E is for SPI transmission\n\r"); - length = read + data; - i = (plength-1); + // pc.printf("command E is for SPI transmission\n\r"); + length = read + data; + i = (plength-1); + } + break; + } + case 'Z': + { + s = false; + pc.printf("command Z is not implemented\n\r"); + i=plength; + break; } - break; - } - case 'Z': - { - s = false; - pc.printf("command Z is not implemented\n\r"); - i=plength; - break; - } - case 'V': - { - s = false; - pc.printf("command V is not implemented\n\r"); - i=plength; - break; - } - default: - { - s = false; - pc.printf("command %c is not implemented\n\r", recieve[i]); - i = plength; - break; + case 'V': + { + s = false; + pc.printf("command V is not implemented\n\r"); + i=plength; + break; + } + default: + { + s = false; + pc.printf("command %c is not implemented\n\r", recieve[i]); + i = plength; + break; + } } } - } - i = 0; - length = 0; + i = 0; + length = 0; } }