Passes 32-bit values between the two cores: rp2040.fifo. More...
#include <RP2040.h>
Public Member Functions | |
| void | push (uint32_t value) |
| Sends a value to the other core, waiting while its queue is full. | |
| bool | push_nb (uint32_t value) |
| Sends a value to the other core if there is room, without waiting. | |
| uint32_t | pop () |
| Takes the next value sent by the other core, waiting until there is one. | |
| bool | pop_nb (uint32_t *value) |
| Takes the next value sent by the other core if there is one, without waiting. | |
| int | available () |
| Number of values the other core has sent that this core has not popped yet. | |
Static Public Attributes | |
| static constexpr unsigned | kDepth = 16 |
| Values each direction can hold before push() waits. | |
Passes 32-bit values between the two cores: rp2040.fifo.
There is one queue for each direction: a value pushed on core 0 is popped on core 1, and the other way round. Each queue holds kDepth values. A value can be a number or a pointer cast to uint32_t.
This is a queue in RAM, not the RP2040's hardware FIFO, which the core uses to stop the other core (idleOtherCore()) and FreeRTOS uses for scheduling. Do not use the SDK's multicore_fifo_*() functions in a sketch.
With FreeRTOS, "this core" is the core the calling task runs on: use the FIFO from loop() and loop1() (each pinned to its core) or from tasks pinned with vTaskCoreAffinitySet(). A task waiting in push() or pop() is blocked, so other tasks run meanwhile.
| int RP2040FifoClass::available | ( | ) |
Number of values the other core has sent that this core has not popped yet.
| uint32_t RP2040FifoClass::pop | ( | ) |
Takes the next value sent by the other core, waiting until there is one.
| bool RP2040FifoClass::pop_nb | ( | uint32_t * | value | ) |
Takes the next value sent by the other core if there is one, without waiting.
| value | Set to the value; unchanged if there is none. |
| void RP2040FifoClass::push | ( | uint32_t | value | ) |
Sends a value to the other core, waiting while its queue is full.
| value | Value to send. |
| bool RP2040FifoClass::push_nb | ( | uint32_t | value | ) |
Sends a value to the other core if there is room, without waiting.
| value | Value to send. |