added fliper items
This commit is contained in:
1
.idea/.name
generated
1
.idea/.name
generated
@@ -1 +0,0 @@
|
|||||||
flippr_code
|
|
||||||
10
.idea/misc.xml
generated
10
.idea/misc.xml
generated
@@ -1,6 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$">
|
||||||
|
<contentRoot DIR="$PROJECT_DIR$/FlippR-Driver/build" />
|
||||||
|
</component>
|
||||||
|
<component name="CidrRootsConfiguration">
|
||||||
|
<sourceRoots>
|
||||||
|
<file path="$PROJECT_DIR$/FlippR-Driver/include" />
|
||||||
|
<file path="$PROJECT_DIR$/FlippR-Driver/src" />
|
||||||
|
</sourceRoots>
|
||||||
|
</component>
|
||||||
<component name="JavaScriptSettings">
|
<component name="JavaScriptSettings">
|
||||||
<option name="languageLevel" value="ES6" />
|
<option name="languageLevel" value="ES6" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
992
.idea/workspace.xml
generated
992
.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -197,4 +197,4 @@ add_executable(flippr_code
|
|||||||
FlippR-Driver/tests/catch.hpp
|
FlippR-Driver/tests/catch.hpp
|
||||||
FlippR-Driver/tests/fakeit.hpp
|
FlippR-Driver/tests/fakeit.hpp
|
||||||
FlippR-Driver/tests/main.cpp
|
FlippR-Driver/tests/main.cpp
|
||||||
FlippR-Driver/CMakeLists.txt FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp FlippR-Driver/src/utility/networking/output/OutputRequestHandler.h FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.cpp FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.h FlippR-Driver/src/utility/networking/output/OutputHTTPServer.cpp FlippR-Driver/src/utility/networking/output/OutputHTTPServer.h FlippR-Driver/src/utility/networking/input/TcpServer.cpp FlippR-Driver/src/utility/networking/input/TcpServer.h FlippR-Driver/src/utility/networking/input/SocketHandler.cpp FlippR-Driver/src/utility/networking/input/SocketHandler.h)
|
FlippR-Driver/CMakeLists.txt FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp FlippR-Driver/src/utility/networking/output/OutputRequestHandler.h FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.cpp FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.h FlippR-Driver/src/utility/networking/output/OutputHTTPServer.cpp FlippR-Driver/src/utility/networking/output/OutputHTTPServer.h FlippR-Driver/src/utility/networking/input/TcpServer.cpp FlippR-Driver/src/utility/networking/input/TcpServer.h FlippR-Driver/src/utility/networking/input/SocketHandler.cpp FlippR-Driver/src/utility/networking/input/SocketHandler.h FlippR-Driver/include/output/items/Flipper.h FlippR-Driver/src/output/items/detail/Flipper.cpp FlippR-Driver/src/output/items/detail/Flipper.h)
|
||||||
|
|||||||
33
FlippR-Driver/include/output/items/Flipper.h
Normal file
33
FlippR-Driver/include/output/items/Flipper.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Flipper.h
|
||||||
|
*
|
||||||
|
* Created on: May 5, 2019
|
||||||
|
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_FLIPPR_CODE_FLIPPER_H
|
||||||
|
#define _INCLUDE_FLIPPR_CODE_FLIPPER_H
|
||||||
|
|
||||||
|
namespace flippR_driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
|
class Flipper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~Flipper() = default;
|
||||||
|
|
||||||
|
virtual void activate() = 0;
|
||||||
|
virtual void deactivate() = 0;
|
||||||
|
virtual bool is_activated() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //FLIPPR_CODE_FLIPPER_H
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "output/items/detail/Item.h"
|
#include "output/items/detail/Item.h"
|
||||||
|
|
||||||
#include <output/DriverBoardPinController.h>
|
#include "../DriverBoardPinController.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|||||||
54
FlippR-Driver/src/output/items/detail/Flipper.cpp
Normal file
54
FlippR-Driver/src/output/items/detail/Flipper.cpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Flipper.cpp
|
||||||
|
*
|
||||||
|
* Created on: May 6, 2019
|
||||||
|
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Flipper.h"
|
||||||
|
#include "../DriverBoardItem.h"
|
||||||
|
|
||||||
|
#include "utility/config.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace flippR_driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
Flipper::Flipper(std::shared_ptr<DriverBoardPinController> pin_controller, uint8_t address, std::string name) :
|
||||||
|
DriverBoardItem(pin_controller, address, name)
|
||||||
|
{
|
||||||
|
CLOG(INFO, OUTPUT_LOGGER) << "Created Flipper relay " << this->name << " with address " << this->address;
|
||||||
|
}
|
||||||
|
|
||||||
|
Flipper::~Flipper()
|
||||||
|
{
|
||||||
|
this->deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Flipper::activate()
|
||||||
|
{
|
||||||
|
CLOG(INFO, OUTPUT_LOGGER) << "Flipper " << name << "activated";
|
||||||
|
this->pin_controller->activate(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Flipper::deactivate()
|
||||||
|
{
|
||||||
|
CLOG(INFO, OUTPUT_LOGGER) << "Flipper " << name << "deactivated";
|
||||||
|
this->pin_controller->deactivate(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Flipper::is_activated()
|
||||||
|
{
|
||||||
|
return this->is_activated();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
44
FlippR-Driver/src/output/items/detail/Flipper.h
Normal file
44
FlippR-Driver/src/output/items/detail/Flipper.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Flipper.h
|
||||||
|
*
|
||||||
|
* Created on: May 6, 2019
|
||||||
|
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SRC_FLIPPR_CODE_FLIPPER_H
|
||||||
|
#define _SRC_FLIPPR_CODE_FLIPPER_H
|
||||||
|
|
||||||
|
#include "output/items/Flipper.h"
|
||||||
|
#include "output/items/DriverBoardItem.h"
|
||||||
|
|
||||||
|
namespace flippR_driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
class Flipper : public items::Flipper, public DriverBoardItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Flipper(std::shared_ptr<DriverBoardPinController> pin_controller, uint8_t address, std::string name);
|
||||||
|
~Flipper() override;
|
||||||
|
|
||||||
|
void activate() override;
|
||||||
|
void deactivate() override;
|
||||||
|
bool is_activated() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool activated;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //FLIPPR_CODE_FLIPPER_H
|
||||||
@@ -27,11 +27,11 @@ DriverBoardItem(std::move(pin_controller), address, std::move(name)), deactivati
|
|||||||
|
|
||||||
void Solenoid::triggerTask()
|
void Solenoid::triggerTask()
|
||||||
{
|
{
|
||||||
pin_controller->activate(*this);
|
this->pin_controller->activate(*this);
|
||||||
|
|
||||||
std::this_thread::sleep_for(deactivation_time);
|
std::this_thread::sleep_for(deactivation_time);
|
||||||
|
|
||||||
pin_controller->deactivate(*this);
|
this->pin_controller->deactivate(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Solenoid::trigger()
|
void Solenoid::trigger()
|
||||||
|
|||||||
Reference in New Issue
Block a user