开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: swr_bridge.ino


 

Right. That is what I thought... we might not want too much code inside the interrupt handler function. We could also use a flag written by any atomic ATMEL instruction and use a double buffer, if the flag is up, for eg, we use buffer 2, if the flag is down, buffer 1.

Anyway, the code you proposed disabling interrupts should be ok, as reading about the I2C, it seems that if we turn off interrupts just a bit, we'll not lose the I2C interrupt, as it will just be delayed. I need to read the ATMEGA datasheet to make sure about this (and of course, testing also).

Buuut... As the ATTiny85 might not have any other interrupt (if we remove that delay()), I also would consider reading the two ports and writing the answer inside the interrupt handler, if it all goes well... then problem solved.
: )

Rafael

On 5/3/23 06:08, Steve Beckman wrote:
Rafael - Not sure that we would want to have the extra code being executed after the interrupt gets called but before the message is written back out via i2c. I agree that it would eliminate the need to take steps to make the array fill atomic.

Soon we will be able to try it and see what happens.

73; Steve, N3SB

Join [email protected] to automatically receive all group messages.