54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
/*
|
|
* 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, const uint8_t & address, const uint8_t & pin_base, const std::string & name) :
|
|
Item(std::move(name)), DriverBoardItem(pin_controller, address, pin_base), pin_controller(std::move(pin_controller))
|
|
{
|
|
CLOG(DEBUG, OUTPUT_LOGGER) << "Created flipper \"" << name << "\" with pin-base " << int(pin_base) << " and address " << int(address);
|
|
}
|
|
|
|
Flipper::~Flipper()
|
|
{
|
|
this->deactivate();
|
|
}
|
|
|
|
void Flipper::activate()
|
|
{
|
|
CLOG(DEBUG, OUTPUT_LOGGER) << "Flipper " << name << " activated";
|
|
this->pin_controller->activate(*this);
|
|
}
|
|
|
|
void Flipper::deactivate()
|
|
{
|
|
CLOG(DEBUG, OUTPUT_LOGGER) << "Flipper " << name << " deactivated";
|
|
this->pin_controller->deactivate(*this);
|
|
}
|
|
|
|
bool Flipper::is_activated()
|
|
{
|
|
return this->is_activated();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
} |