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