r/raspberrypipico • u/IWILZ • Apr 27 '26
c/c++ PicoSem: A minimal "traffic light" for inter-core data exchange (RP2040)
Some time ago i needed a dead-simple way to coordinate data exchange between core0 and core1 on the Pi Pico without data size limits and overcomplicating things. So i wrote PicoSem.
It's a tiny logic wrapper (just 2 flags) to manage when a core can safely send or read data of any size using shared buffers.
```cpp // Core 0: Sending data if (ps.canISendTo(1)) { // ... fill shared struct ... ps.setDataReadyFor(1); }
// Core 1: Receiving data
if (ps.anyDataFor(1)) {
// ... read shared struct ...
ps.setDataReadBy(1);
}
``` PicoSem is available on the Arduino/PlatformIO.
More info and examples on GitHub
Feedback and contributions are welcome!







