stevemarple / SoftWire

Software I2C implementation for Arduino and other Wiring-type environments
GNU Lesser General Public License v2.1
144 stars 30 forks source link

use noInterrtups() instead of the Atomic block? #6

Closed ghost closed 6 years ago

ghost commented 6 years ago

I needed to do this to have it work on my Arduino Primo.

Koepel commented 6 years ago

The atomic block restores the state. The noInterrupts() and interrupts() do not. It is not the same.

Using the SoftwareWire in a situation where the interrupts should be off all the time is rare, but not unlikely, since the SoftwareWire might be chosen over the Wire library just because interrupts can stay off.

Will the Arduino Primo with nRF52 processor support the ATOMIC_BLOCK macro in the future ?

stevemarple commented 6 years ago

I think the ATOMIC_BLOCK block is AVR-specific. @Thomasrutgers: is there an NRF equivalent macro that can be used. Better would be a generic libc equivalent but I'm not aware of one.

ghost commented 6 years ago

Ok, I see. Will look into this.

stevemarple commented 6 years ago

@Thomasrutgers Does v1.1.0 compile for you?

ghost commented 6 years ago

@stevemarple Yes, compiles! Haven't tested all of it, but the listdevices example is working.