-
Notifications
You must be signed in to change notification settings - Fork 24
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
Use case that is not supported #20
Comments
Does 'code_that_uses_said_master' call i2c.shutdown() before finishing?
|
Aha! That is a very interesting suggestion. So - the requirement for a [[distributable]] task is that it ends with a I will try this. |
That does the trick nicely. However, the code produced is slightly unexpected: it generates lots of indirect function calls (BLA) for the i2c read and write functions; I had expected the compiler to make them into direct calls, with a sequence of 22 instructions leading up to each call. Closing this issue, it may be worth understanding why the compiler, in this case, isn't able to make them direct calls. |
I am trying to write a piece of code, and somewhere in the middle of a long call tree, I need to use I2C. This is the only place I need I2C, I don't need it anywhere else.
Ideally, I would just call two functions 'READ' and 'WRITE' to interact with I2C. However, to do that I need to create an interface to an I2C master, but when I do that I end up with a thread that won't die.
How do I write that, without having to change my whole call tree to pass an i2c interface around? I am never concerned about sharing, as this is my final application. f() is a call back from other libraries, and hence I do not want to change it.
Ugly solutions include starting i2c_single_port_master at top level and somehow storing the i2c interface in a global.
Clean solutions would be to just use i2c_read and i2c_write functions; I am missing a trick as to how to use those functions encapsulated in the interface without actually creating the interface as an ever-running task.
The text was updated successfully, but these errors were encountered: