minor changes
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* IOutputDisplay.h
|
||||
*
|
||||
* Created on: Nov 20, 2018
|
||||
* Author: johannes
|
||||
*/
|
||||
|
||||
#ifndef SRC_OUTPUT_IOUTPUTDISPLAY_H_
|
||||
#define SRC_OUTPUT_IOUTPUTDISPLAY_H_
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
|
||||
class IDisplay
|
||||
{
|
||||
|
||||
public:
|
||||
IDisplay();
|
||||
virtual ~IDisplay();
|
||||
|
||||
virtual void write_score(int score) = 0;
|
||||
virtual void write_content(std::array<char, DigitCount> content) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* SRC_OUTPUT_IOUTPUTDISPLAY_H_ */
|
||||
@@ -19,7 +19,6 @@ namespace items
|
||||
class IOutputItem
|
||||
{
|
||||
virtual ~IOutputItem();
|
||||
virtual bool isActivated() = 0;
|
||||
virtual bool activate() = 0;
|
||||
virtual bool deactivate() = 0;
|
||||
};
|
||||
|
||||
24
FlippR-Driver/src/output/items/OutputItem.cpp
Normal file
24
FlippR-Driver/src/output/items/OutputItem.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Created by rhetenor on 21.11.18.
|
||||
//
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
|
||||
void OutputItem::activate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OutputItem::deactivate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ protected:
|
||||
|
||||
std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface;
|
||||
|
||||
protected:
|
||||
void activate();
|
||||
void deactivate();
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
|
||||
Solenoid::Solenoid(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, std::chrono::milliseconds deactivation_time)
|
||||
:
|
||||
OutputItem(output_gpio_interface, i2c_address, data_pin, name),
|
||||
@@ -23,10 +24,11 @@ void Solenoid::triggerTask()
|
||||
{
|
||||
OutputItem::activate();
|
||||
|
||||
std::this_thread::sleep_for(50 /*todo change magic number */);
|
||||
std::this_thread::sleep_for(deactivation_time);
|
||||
|
||||
OutputItem::deactivate();
|
||||
}
|
||||
|
||||
void Solenoid::trigger()
|
||||
{
|
||||
std::async(std::launch::async, &Solenoid::triggerTask);
|
||||
|
||||
@@ -30,6 +30,9 @@ public:
|
||||
|
||||
void trigger();
|
||||
|
||||
private:
|
||||
std::chrono::milliseconds deactivation_time;
|
||||
|
||||
private:
|
||||
virtual void triggerTask();
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace items
|
||||
|
||||
Sound::Sound(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name)
|
||||
:
|
||||
OutputItem(output_gpio_interface, i2c_address, data_pin, name)
|
||||
OutputItem(output_gpio_interface, i2c_address, data_pin, name),
|
||||
deactivation_time(deactivation_time)
|
||||
{}
|
||||
|
||||
void Sound::play()
|
||||
@@ -30,7 +31,7 @@ void Sound::playTask()
|
||||
{
|
||||
OutputItem::activate();
|
||||
|
||||
std::this_thread::sleep_for(50 /*todo change magic number */);
|
||||
std::this_thread::sleep_for(deactivation_time);
|
||||
|
||||
OutputItem::deactivate();
|
||||
}
|
||||
|
||||
@@ -25,11 +25,14 @@ namespace items
|
||||
class Sound : public ISound, OutputItem
|
||||
{
|
||||
public:
|
||||
Sound(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name);
|
||||
Sound(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, std::chrono::milliseconds deactivation_time);
|
||||
virtual ~Sound() = default;
|
||||
|
||||
virtual void play();
|
||||
|
||||
private:
|
||||
std::chrono::milliseconds deactivation_time;
|
||||
|
||||
private:
|
||||
virtual void playTask();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user