Timeline for Use class object inside an ISR
Current License: CC BY-SA 4.0
20 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 26 at 16:08 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Mar 28 at 15:01 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Nov 28, 2024 at 14:06 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jul 31, 2024 at 14:03 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Apr 2, 2024 at 17:21 | review | Close votes | |||
Apr 7, 2024 at 3:03 | |||||
Apr 2, 2024 at 13:02 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Dec 4, 2023 at 12:07 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Nov 4, 2023 at 21:40 | comment | added | Nick Gammon♦ | This isn't a forum. If you want to expand on the question please edit the question. Any answers given should address the question (as edited), not the question plus random comments. Nor should the answer be in a comment (not your fault). | |
S Nov 4, 2023 at 11:26 | history | suggested | Ergophobia | CC BY-SA 4.0 |
corrected spelling, improved formatting
|
Nov 4, 2023 at 11:23 | review | Suggested edits | |||
S Nov 4, 2023 at 11:26 | |||||
Nov 4, 2023 at 11:08 | comment | added | lumaca96 |
@Delta_G thanks! Let's say that I'm also setting some attributes of the adc object in an interrupt. How can I deal with that case? I've edited the original post to include this case (see slaveReceiverHandler ). Shall I declare the object (and the whole class attributes and methods) as volatile ? I guess so, but it seems that it's not really clear to me what volatile means when used in a C++ class (en.cppreference.com/w/cpp/language/cv this page goes above my understanding).
|
|
Nov 4, 2023 at 11:02 | history | edited | lumaca96 | CC BY-SA 4.0 |
added 597 characters in body
|
Nov 4, 2023 at 6:33 | history | edited | dda | CC BY-SA 4.0 |
added 4 characters in body; edited title
|
Nov 4, 2023 at 6:09 | review | Close votes | |||
Nov 19, 2023 at 3:02 | |||||
Nov 4, 2023 at 5:28 | answer | added | Nick Gammon ♦ | timeline score: 0 | |
Nov 4, 2023 at 5:23 | comment | added | Nick Gammon♦ |
Why are you doing Wire.onRequest(slaveTransmitterHandler) ? That looks like you really are using I2C and not simulating it.
|
|
Nov 4, 2023 at 5:17 | comment | added | Nick Gammon♦ | @Delta_G This looks like an answer. Please post one and not a comment. Thank you. | |
Nov 3, 2023 at 18:56 | comment | added | Delta_G | I don't think the class has to be volatile here. Nothing in the ISR is changing anything about the class, so there's no chance that the ISR fires in the middle of something else accessing the class and getting corrupted data. The only possibility for corruption here would be if the ISR fired diring the write function but you seem to have handled that with a critical section around it. It would be different if the ISR wrote to the object, but as written it only reads from it. I think you're ok here. | |
Nov 3, 2023 at 17:18 | history | edited | lumaca96 | CC BY-SA 4.0 |
added 1 character in body
|
Nov 3, 2023 at 17:02 | history | asked | lumaca96 | CC BY-SA 4.0 |