forked from SBC-Collaboration/SBC-Queens-SIPMs-GUI-Software
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
81 lines (65 loc) · 1.78 KB
/
main.cpp
File metadata and controls
81 lines (65 loc) · 1.78 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// STL includes
#include <thread>
// 3rd party includes
#include <spdlog/spdlog.h>
#include <readerwriterqueue.h>
// My includes
// Only have 1 include at a time!
#ifdef USE_VULKAN
#include "rendering_wrappers/glfw_vulkan_wrapper.h"
#else
#include "rendering_wrappers/glfw_opengl3_wrapper.h"
#endif
#include "imgui_helpers.h"
#include "TeensyControllerInterface.h"
#include "CAENDigitizerInterface.h"
#include "GUIManager.h"
int main(int argc, char *argv[])
{
spdlog::info("Starting software");
SBCQueens::TeensyInQueue guiQueueOut;
SBCQueens::CAENQueue caenQueue;
SBCQueens::SiPMsPlotQueue plotQueue;
// This is our GUI function which actually holds all of our buttons
// labels, inputs, graphs and ect
SBCQueens::GUIManager guiManager(
// From GUI -> Teensy
guiQueueOut,
// From GUI -> CAEN
caenQueue,
// From Anyone -> GUI
plotQueue
);
// This function just holds the rendering framework we are using
// all of them found under rendering_wrappers
// We wrapping it under a lambda so we can pass it to a thread
// because we do not care about its returning vallue
auto gui_wrapper = [&]() {
#ifdef USE_VULKAN
ImGUIWrappers::main_glfw_vulkan_wrapper(guiManager);
#else
ImGUIWrappers::main_glfw_open3gl_wrapper(guiManager);
#endif
};
// std::thread main_thread(gui_wrapper);
// The lambdas we are passing are the functions
// to read and write to the queue
SBCQueens::TeensyControllerInterface tc(
// GUI -> Teensy
guiQueueOut,
// From Anyone -> GUI
plotQueue
);
std::thread tc_thread(std::ref(tc));
SBCQueens::CAENDigitizerInterface caenc(
plotQueue,
caenQueue
);
std::thread caen_thread(std::ref(caenc));
spdlog::info("Starting threads");
tc_thread.detach();
caen_thread.detach();
gui_wrapper();
spdlog::info("Closing software");
return 0;
}