This library provides a low-level facility for context switching between multiple threads of execution and contains an implementation of asymmetric stackful coroutines on an AVR micro-controller.
The low level context switching facility consists of a data type (avr_context_t), functions (avr_getcontext(), avr_setcontext(), avr_makecontext(), avr_swapcontext()), and macros (AVR_SAVE_CONTEXT, AVR_RESTORE_CONTEXT, AVR_SAVE_CONTEXT_GLOBAL_POINTER, AVR_RESTORE_CONTEXT_GLOBAL_POINTER). The asymmetric stackful coroutines facility consists of a data type (avr_coro_t), and four functions (avr_coro_init(), avr_coro_resume(), avr_coro_yield(), avr_coro_state()). This functionality is implemented on top of the context switching facility.

Author: Artem Boldariev

Maintainer: Artem Boldariev

Read the documentation


This library is compatible with the avr, megaavr architectures so you should be able to use it on the following Arduino boards:


To use this library, open the Library Manager in the Arduino IDE and install it from there.