i2c Slave
Opened this issue · 1 comments
Hi,
Do you have an example of using a cforth app acting as an i2c slave ?
I'm thinking of using a STM32F103 'blue pill' board for a project.
Thanks,
Andrew
I don't have an example, but it seems like something that would be pretty easy to do, depending on your app's flow control requirements. One way would be for the main loop to poll the I2C address-matched bit in 2C_SR1 , and then read from or write to the data register as necessary. You could do something at interrupt level by adding a bit of C code to the mix, but if your main loop never spends a long time doing other stuff, or if your overall flow control ensures that the I2C master never sends at an inopportune time, you can achieve great simplicity, and thus reliability, buy doing everything in one main loop.