Skip to content

Commit

Permalink
Remove prototype code
Browse files Browse the repository at this point in the history
  • Loading branch information
laszloh committed Nov 13, 2023
1 parent 9d9734c commit f8c7844
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
8 changes: 0 additions & 8 deletions src/Queues.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#include <Arduino.h>
#include "settings.h"

#include "Queues.h"

#include "Log.h"
#include "Playlist.h"
#include "Rfid.h"

SharedObject<int> gVolume;
SharedObject<uint8_t> gTrackControl;
SharedObject<std::unique_ptr<Playlist>> gTrack;
SharedObject<char[cardIdStringSize]> gRfidCard;

QueueHandle_t gVolumeQueue;
QueueHandle_t gTrackQueue;
QueueHandle_t gTrackControlQueue;
Expand Down
32 changes: 1 addition & 31 deletions src/Queues.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,4 @@ extern QueueHandle_t gVolumeQueue;
extern QueueHandle_t gTrackControlQueue;
extern QueueHandle_t gRfidCardQueue;

void Queues_Init(void);

#include "Rfid.h"

#include <memory>
#include <mutex>

template <typename T>
class SharedObject {
public:
SharedObject() = default;
~SharedObject() = default;

const T &get() {
std::lock_guard guard(mutex);
return obj;
}

void put(T newObj) {
std::lock_guard guard(mutex);
obj = newObj;
}

private:
T obj {};
std::mutex mutex {};
};

extern SharedObject<int> gVolume;
extern SharedObject<uint8_t> gTrackControl;
extern SharedObject<char[cardIdStringSize]> gRfidCard;
void Queues_Init(void);

0 comments on commit f8c7844

Please sign in to comment.