実験 共有(I2C AQM0802) PSoC4 Raspberry Pi Zero WH

実験 共有(I2C AQM0802 LCD) PSoC4 Raspberry Pi Zero WH
I2C Slave AQM0802(address 0x3E)共有
I2C Master Raspberry Pi
I2C Multi-Master-Slave PSoC4(address 0x08)
$ i2cdetect -y 1 #AQM0802 と PSoC4 を認識している

Code Python Raspberry Pi

import smbus,time

i2c1=smbus.SMBus(1) #0=(port I2C0), 1=(port I2C1)
i2c1.write_i2c_block_data(0x3E,0x00,[0x38,0x39,0x14,0x78,0x5E,0x6A]); time.sleep(0.200) #200ms
i2c1.write_i2c_block_data(0x3E,0x00,[0x0C,0x01]); time.sleep(0.002) #2ms
i2c1.write_byte_data(0x3E,0x00,0x06)
i2c1.write_byte_data(0x3E,0x00,0xC0) #0x80=1st line #0xC0=2nd
i2c1.write_i2c_block_data(0x3E,0x40,[ord(' '),ord(' '),ord('P'),ord('i'),ord(' '),ord('I'),ord('2'),ord('C')])

d=1
while 1:
    d=0x30+((1+d)%10) #9-0 countdown ascii
    time.sleep(1.000) #1s
    try:
        i2c1.write_byte_data(0x3E,0x00,0xC0) #0xC0=2nd line
        i2c1.write_byte_data(0x3E,0x40,d)
    except Exception as e:
        pass ;print(e) #error if exist

Code C PSoC4

...
    const uint8 b0[]={0x00,  0x80}; //1st 0x00 not valid //0x80=1st line 0xC0=2nd line
    const uint8 b1[]={0x00,  ' ',' ','P','S','o','C','4'}; //1st 0x00 not valid
    uint8   d[2];
	while(1) {
		CyDelay(1000);        
                I2C_write((uint8 *)b0, 0x3E, 0x00, 1);
                I2C_write((uint8 *)b1, 0x3E, 0x40, 7);
                d[1]=0x30+((1+d[1])%10); //9-0 countdown ascii
                I2C_write((uint8 *)b0, 0x3E, 0x00, 1);
                I2C_write((uint8 *)d,  0x3E, 0x40, 1);
...


I2C Master PSoC4 の設定でも共有可(通信のコンフリクトがあるだろう)