MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/driver/DiscreteOutput_DoublePin.cpp
2024-06-07 11:12:56 +03:00

35 lines
784 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* DiscreteOutput_DoublePin.cpp
*
* Created on: 3 дек. 2018 г.
* Author: titov
*/
#include "DiscreteOutput_DoublePin.hh"
driver::detail::DiscreteOutput_DoublePin::DiscreteOutput_DoublePin(
peripheral::IGpio & one, bool active_one,
peripheral::IGpio & two, bool active_two ) :
one(one), two(two), active_one(active_one), active_two(active_two) {}
void driver::detail::DiscreteOutput_DoublePin::on() {
one.write( active_one );
two.write( active_two );
}
void driver::detail::DiscreteOutput_DoublePin::off() {
two.write( not active_two );
one.write( not active_one );
}
bool driver::detail::DiscreteOutput_DoublePin::isCompleted() const {
return one.read() == active_one
and two.read() == active_two;
}