-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWaveuHelper.cpp
More file actions
43 lines (34 loc) · 1.06 KB
/
WaveuHelper.cpp
File metadata and controls
43 lines (34 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "esp_log.h"
#include "Semaphores.h"
#include "Queues.h"
#include "DataTypes.h"
#include "WaveuHelper.h"
namespace tinyalg::waveu {
const char* WaveuHelper::TAG = "WaveuHelper";
bool WaveuHelper::initQueues() {
size_t queueLength = 1;
dataGenerationQueue = xQueueCreate(queueLength, sizeof(data_generation_msg_type_t));
if (dataGenerationQueue == 0) {
ESP_LOGE(TAG, "dataGenerationQueue cannot be created.");
return false;
}
queueLength = 10;
dataOutputQueue = xQueueCreate(queueLength, sizeof(data_output_msg_type_t));
if (dataOutputQueue == 0) {
ESP_LOGE(TAG, "dataOutputQueue cannot be created.");
return false;
}
return true;
}
void WaveuHelper::initSemaphore()
{
pingBufferSemaphore = xSemaphoreCreateMutex();
if (pingBufferSemaphore == NULL) {
ESP_LOGE(TAG, "semaphore creation failure");
}
pongBufferSemaphore = xSemaphoreCreateMutex();
if (pongBufferSemaphore == NULL) {
ESP_LOGE(TAG, "semaphore creation failure");
}
}
} // namespace tinyalg::waveu