This commit is contained in:
Jonas Zeunert
2018-10-10 12:31:20 +02:00
parent 6c785845ef
commit 07963413eb
5 changed files with 47 additions and 7 deletions

View File

@@ -0,0 +1,12 @@
//
// Created by rhetenor on 10.10.18.
//
namespace FlippR_Driver
{
namespace output
{
}
}

View File

@@ -21,7 +21,7 @@ class Display : public IDisplay
{ {
public: public:
Display(); Display();
virtual ~Display(); virtual ~Display() = default;
virtual int getID(); virtual int getID();

View File

@@ -14,16 +14,27 @@ namespace FlippR_Driver
namespace output namespace output
{ {
DisplayController::DisplayController(std::vector<std::shared_ptr<IDisplay>> displays) DisplayController::DisplayController(std::vector<std::shared_ptr<IDisplay>> displays, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface)
: displays(displays) : displays(displays), output_gpio_interface(output_gpio_interface), is_running(true)
{ {
this->display_cycle_thread = std::thread(&DisplayController::cycle_displays, this); this->display_cycle_thread = std::thread(&DisplayController::cycle_displays, this);
CLOG(INFO, OUTPUT_LOGGER) << "Created DisplayController and started writing them."; CLOG(INFO, OUTPUT_LOGGER) << "Created DisplayController and started writing them.";
} }
DisplayController::~DisplayController()
{
this->is_running = false;
this->display_cycle_thread.join();
}
void DisplayController::cycle_displays() void DisplayController::cycle_displays()
{ {
while(is_running)
{
}
for(auto& display : displays) for(auto& display : displays)
{ {

View File

@@ -10,11 +10,12 @@
#include "IDisplayController.h" #include "IDisplayController.h"
#include "IDisplay.h"
#include <vector> #include <vector>
#include <thread> #include <thread>
#include "IDisplay.h"
#include "utilities/IOutputGPIOInterface.h"
namespace FlippR_Driver namespace FlippR_Driver
{ {
namespace output namespace output
@@ -23,8 +24,8 @@ namespace output
class DisplayController : public IDisplayController class DisplayController : public IDisplayController
{ {
public: public:
explicit DisplayController(std::vector<std::shared_ptr<IDisplay>> displays); explicit DisplayController(std::vector<std::shared_ptr<IDisplay>> displays, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface);
virtual ~DisplayController(); ~DisplayController();
private: private:
void cycle_displays(); void cycle_displays();
@@ -33,6 +34,10 @@ private:
std::vector<std::shared_ptr<IDisplay>> displays; std::vector<std::shared_ptr<IDisplay>> displays;
std::thread display_cycle_thread; std::thread display_cycle_thread;
std::shared_ptr<IOutputGPIOInterface> output_gpio_interface;
bool is_running;
}; };
} }

View File

@@ -0,0 +1,12 @@
//
// Created by rhetenor on 10.10.18.
//
#ifndef FLIPPR_DRIVER_IOUTPUTGPIOINTERFACE_H
#define FLIPPR_DRIVER_IOUTPUTGPIOINTERFACE_H
class IOutputGPIOInterface
{
};
#endif //FLIPPR_DRIVER_IOUTPUTGPIOINTERFACE_H