8 months, 3 weeks 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?

Example:--

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).

Thanks

Comment on this question

1 Answer

8 months, 2 weeks ago.

Hi, probably yes...

something...

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


You need to log in to post a question