Skip to content

Instantly share code, notes, and snippets.

@castorinop
Created January 14, 2021 16:42
Show Gist options
  • Save castorinop/90f1909376bf1adca896ac425e168f2a to your computer and use it in GitHub Desktop.
Save castorinop/90f1909376bf1adca896ac425e168f2a to your computer and use it in GitHub Desktop.
#include <cppQueue.h>
#include <core/MyMessage.h>
#include <core/MySensorsCore.h>
#if !defined(IMPLEMENTATION)
#define IMPLEMENTATION FIFO
#endif
#if !defined(QUEUE_SIZE)
#define QUEUE_SIZE 16
#endif
cppQueue q(sizeof(MyMessage), QUEUE_SIZE, IMPLEMENTATION); // Instantiate queue
void queue(MyMessage msg) {
q.push(&msg);
}
void send() {
if (!q.isEmpty()) {
MyMessage msg;
q.pop(&msg);
send(msg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment