Arduino/AVR Atomic Instruction / Mutex / Semaphore

Arduino\hardware\arduino\avr\cores\arduino\Arduino.h
sei()  ==> interrupts()
cli()  ==> noInterrupts()

oder über das Macro:

ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
  // Do some atomic operation inside here
}

avr-libc

avr/interrupt.h: Interrupts
util/atomic.h: Atomically and Non-Atomically Executed Code Blocks

Arduino

attachInterrupt()
noInterrupts()
interrupts()
ow to “Multithread” an Arduino (Protothreading Tutorial)

Portable

github.com/wizard97/SimplyAtomic: Simple Arduino portable atomic macros (Portable: AVR, ARM, ESP8266, ESP32)

learn.adafruit.com

Multi-tasking the Arduino – Part 1
Multi-tasking the Arduino – Part 2
Multi-tasking the Arduino – Part 3

Questions

Do interrupts interrupt other interrupts on Arduino?

occam-pi

occam-pi in a nutshell
occam (programming language), concurrent programming language that builds on the communicating sequential processes (CSP) process algebra
concurrency.cc – Parallel programming for the rest of us

Leave a Reply

Your email address will not be published. Required fields are marked *