fixed some displays
This commit is contained in:
@@ -93,6 +93,9 @@ else()
|
||||
add_library(${PROJECT_NAME} STATIC ${SOURCES})
|
||||
endif(BUILD_SHARED_LIB)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
######################### BOOST #########################
|
||||
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
if(Boost_FOUND)
|
||||
@@ -104,9 +107,6 @@ else()
|
||||
message (FATAL_ERROR "Can't find Boost.")
|
||||
endif(Boost_FOUND)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
# Set libraries include path
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/${LIB_DIR})
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#ifndef _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
||||
#define _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
||||
|
||||
#include "output/items/impl/Lamp.h"
|
||||
#include "output/items/Solenoid.h"
|
||||
#include "output/items/OutputDisplay.h"
|
||||
#include "output/items/Lamp.h"
|
||||
#include "output/items/Sound.h"
|
||||
#include <output/items/Display.h>
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef SRC_OUTPUT_IOUTPUTDISPLAY_H_
|
||||
#define SRC_OUTPUT_IOUTPUTDISPLAY_H_
|
||||
#ifndef FLIPPR_DRIVER_OUTPUT_ITEMS_DISPLAY_H_
|
||||
#define FLIPPR_DRIVER_OUTPUT_ITEMS_DISPLAY_H_
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
@@ -19,7 +19,7 @@ class Display
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~IOutputDisplay() = default;
|
||||
virtual ~Display() = default;
|
||||
|
||||
virtual void write_score(int score) = 0;
|
||||
};
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// Created by rhetenor on 20.11.18.
|
||||
//
|
||||
|
||||
#ifndef FLIPPR_DRIVER_IEIGHTDIGITDISPLAY_H
|
||||
#define FLIPPR_DRIVER_IEIGHTDIGITDISPLAY_H
|
||||
#ifndef FLIPPR_DRIVER_OUTPUT_ITEMS_EIGHTDIGITDISPLAY_H
|
||||
#define FLIPPR_DRIVER_OUTPUT_ITEMS_EIGHTDIGITDISPLAY_H
|
||||
|
||||
#include "Display.h"
|
||||
#include "output/items/Display.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace flippr_driver
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace flippr_driver
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#include "output/impl/DriverBoardPinController.h"
|
||||
#include "output/impl/SoundBoardPinController.h"
|
||||
|
||||
#include "output/items/impl/EightDigitDisplay.h"
|
||||
#include "output/items/impl/SevenDigitDisplay.h"
|
||||
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
@@ -280,6 +284,14 @@ std::shared_ptr<items::Display> create_display(nlohmann::json &display_json)
|
||||
{
|
||||
return std::make_shared<items::impl::EightDigitDisplay>(address, id);
|
||||
}
|
||||
else if(digits == 7)
|
||||
{
|
||||
return std::make_shared<items::impl::SevenDigitDisplay(address, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new std::logic_error("Display digits can either be 7 or 8");
|
||||
}
|
||||
|
||||
}
|
||||
catch(json::exception &e)
|
||||
|
||||
@@ -18,11 +18,11 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
class Display
|
||||
class OutputDisplay
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~Display() = default;
|
||||
virtual ~OutputDisplay() = default;
|
||||
|
||||
virtual uint8_t get_address() const = 0;
|
||||
virtual std::vector<uint8_t> get_content() const = 0;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef _SRC_OUTPUT_DISPLAY_H_
|
||||
#define _SRC_OUTPUT_DISPLAY_H_
|
||||
#ifndef FLIPPR_DRIVER_OUTPUT_ITEMS_IMPL_DISPLAY_H_
|
||||
#define FLIPPR_DRIVER_OUTPUT_ITEMS_IMPL_DISPLAY_H_
|
||||
|
||||
#include "output/items/OutputDisplay.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace impl
|
||||
{
|
||||
|
||||
template<int DigitCount>
|
||||
class Display : public items::Display
|
||||
class Display : public items::OutputDisplay
|
||||
{
|
||||
public:
|
||||
Display(uint8_t address, uint8_t id);
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
#ifndef FLIPPR_DRIVER_OUTPUT_ITEMS_IMPL_EIGHTDIGITDISPLAY_H
|
||||
#define FLIPPR_DRIVER_OUTPUT_ITEMS_IMPL_EIGHTDIGITDISPLAY_H
|
||||
|
||||
#include "output/items/impl/Display.h"
|
||||
|
||||
#include "output/items/EightDigitDisplay.h"
|
||||
|
||||
namespace flippr_driver
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
@@ -16,7 +18,7 @@ namespace items
|
||||
namespace impl
|
||||
{
|
||||
|
||||
class EightDigitDisplay : public Display<8>, public EightDigitDisplay
|
||||
class EightDigitDisplay : public Display<8>, public items::EightDigitDisplay
|
||||
{
|
||||
public:
|
||||
EightDigitDisplay(uint8_t address, uint8_t id) :
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
#include "output/items/SevenDigitDisplay.h"
|
||||
|
||||
namespace flippr_driver
|
||||
#include "output/items/impl/Display.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
@@ -16,8 +18,15 @@ namespace items
|
||||
namespace impl
|
||||
{
|
||||
|
||||
class SevenDigitDisplay : public Display<7>, SevenDigitDisplay;
|
||||
class SevenDigitDisplay : public Display<7>, public items::SevenDigitDisplay
|
||||
{
|
||||
public:
|
||||
SevenDigitDisplay(uint8_t address, uint8_t id) :
|
||||
Display<7>(address, id) {}
|
||||
|
||||
~SevenDigitDisplay() override = default;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user