1 year, 5 months ago.

I2C slave & I2C Master

Hello Is it possible to reconfigure an I2C module and switch between I2C slave and I2C master during runtime using the Mbed framework?


1). Configure a Mbed board as an I2C slave. 2). Then at some point reconfigure the same I2C port as an I2C master (after a specific slave i2c command is received or a push switch is pressed).


1 Answer

1 year, 5 months ago.

Hi, probably yes...


I2C *master;
I2CSlave *slave;
        if (/*something*/) {  
            master = new I2C(PB_3, PB_10);
            slave = new I2CSlave(PB_9, PB_8);
            master = new I2C(PB_9, PB_8);
            slave = new I2CSlave(PB_3, PB_10);
delete slave;
delete master;