Created
January 14, 2021 16:42
-
-
Save castorinop/90f1909376bf1adca896ac425e168f2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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