Skip to content

Commit

Permalink
Make Concurrency.h part of optional functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Jul 16, 2024
1 parent edd6594 commit 7dc827d
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/AudioHttp/URLStreamBuffered.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "AudioConfig.h"
#if defined(USE_CONCURRENCY) && defined(USE_URL_ARDUINO)
#include "Concurrency/Concurrency.h"
#include "AudioLibs/Concurrency.h"
#include "AudioHttp/URLStream.h"
#include "AudioTools/AudioStreams.h"

Expand Down
11 changes: 11 additions & 0 deletions src/AudioLibs/Concurrency.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once
/**
* @defgroup concurrency Concurrency
* @ingroup main
* @brief Multicore support
*/
#include "Concurrency/QueueRTOS.h"
#include "Concurrency/BufferRTOS.h"
#include "Concurrency/SynchronizedBuffers.h"
#include "Concurrency/Task.h"
#include "Concurrency/LockGuard.h"
4 changes: 3 additions & 1 deletion src/AudioTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@


#include "AudioConfig.h"
#include "Concurrency/Concurrency.h"
#ifdef USE_CONCURRENCY
#include "AudioLibs/Concurrency.h"
#endif
#include "AudioTimer/AudioTimer.h"
#include "AudioTools/AudioTypes.h"
#include "AudioTools/Buffers.h"
Expand Down
2 changes: 0 additions & 2 deletions src/Concurrency/BufferRTOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "AudioTools/AudioLogger.h"
#include "AudioBasic/Collections/Allocator.h"

#if defined(USE_CONCURRENCY)
#ifdef ESP32
# include <freertos/stream_buffer.h>
# include "freertos/FreeRTOS.h"
Expand Down Expand Up @@ -200,4 +199,3 @@ using SynchronizedBufferRTOS = BufferRTOS<T>;

} // namespace audio_tools

#endif
12 changes: 0 additions & 12 deletions src/Concurrency/Concurrency.h

This file was deleted.

2 changes: 0 additions & 2 deletions src/Concurrency/LockGuard.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# include <mutex>
#endif

#if defined(USE_CONCURRENCY)
#ifdef ESP32
# include "freertos/FreeRTOS.h"
# include "freertos/semphr.h"
Expand Down Expand Up @@ -112,4 +111,3 @@ class LockGuard {

}

#endif
6 changes: 4 additions & 2 deletions src/Concurrency/QueueRTOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "AudioBasic/Collections/Allocator.h"
#include "AudioConfig.h"

#if defined(USE_CONCURRENCY)
#ifdef ESP32
# include <freertos/queue.h>
# include "freertos/FreeRTOS.h"
Expand Down Expand Up @@ -97,9 +96,13 @@ class QueueRTOS {

bool setup() {
if (queue_size > 0) {
#if configSUPPORT_STATIC_ALLOCATION
p_data = (uint8_t*)p_allocator->allocate((queue_size + 1) * sizeof(T));
if (p_data == nullptr) return false;
xQueue = xQueueCreateStatic(queue_size, sizeof(T), p_data, &queue_buffer);
#else
xQueue = xQueueCreate(queue_size, sizeof(T));
#endif
if (xQueue == nullptr) return false;
}
return true;
Expand All @@ -113,4 +116,3 @@ class QueueRTOS {

} // namespace audio_tools

#endif
3 changes: 0 additions & 3 deletions src/Concurrency/SynchronizedBuffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "AudioTools/Buffers.h"
#include "AudioTools/AudioLogger.h"

#if defined(USE_CONCURRENCY)
#ifdef ESP32
# include "freertos/FreeRTOS.h"
# include "Concurrency/QueueRTOS.h"
Expand Down Expand Up @@ -202,5 +201,3 @@ class SynchronizedNBuffer : public NBuffer<T> {

} // namespace audio_tools


#endif
2 changes: 0 additions & 2 deletions src/Concurrency/Task.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#if defined(USE_CONCURRENCY)
#ifdef ESP32
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
Expand Down Expand Up @@ -103,4 +102,3 @@ class Task {

} // namespace audio_tools

#endif

0 comments on commit 7dc827d

Please sign in to comment.