Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c Slave #61

Open
andrewtholt opened this issue Jul 20, 2020 · 1 comment
Open

i2c Slave #61

andrewtholt opened this issue Jul 20, 2020 · 1 comment

Comments

@andrewtholt
Copy link

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

@MitchBradley
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants