44 lines
1.6 KiB
C++
44 lines
1.6 KiB
C++
/*
|
|
* PwmTripControllerSetup.cpp
|
|
*
|
|
* Created on: 4 ìàð. 2020 ã.
|
|
* Author: titov
|
|
*/
|
|
|
|
#include "PwmTripController.hh"
|
|
|
|
#include "../../systemic/StatusLazyFast.hpp"
|
|
#include "../../systemic/MemberFuntion.hpp"
|
|
#include "../../schematic/StatusLogic.hpp"
|
|
|
|
bool application::board::PwmTripController::input( Environment & env ) {
|
|
|
|
return grab( trip, env.rholder.getShared<peripheral::IPwmTrip>( links.trip_handler ) );
|
|
|
|
}
|
|
|
|
void application::board::PwmTripController::build( Environment & env ) {
|
|
|
|
typedef systemic::detail::StatusLazyFast<peripheral::IPwmTrip, &peripheral::IPwmTrip::isTripped> Tripped;
|
|
Tripped * tripped = memories::instance_object<Tripped>(env.static_setup_ma, *trip);
|
|
|
|
env.statuses.add(links.one_shot, tripped);
|
|
|
|
typedef systemic::detail::StatusLazyFast<peripheral::IPwmTrip, &peripheral::IPwmTrip::isCycleTripped> CycleTripped;
|
|
|
|
CycleTripped * cycle_tripped = memories::instance_object<CycleTripped>(env.static_setup_ma, *trip);
|
|
env.statuses.add(links.cycle_by_cycle, cycle_tripped);
|
|
|
|
systemic::detail::StatusNot * not_tripped = memories::instance_object<systemic::detail::StatusNot>(env.static_setup_ma, *tripped);
|
|
|
|
typedef systemic::detail::MemberFuntionExternalResult<peripheral::IPwmTrip, bool, &peripheral::IPwmTrip::resetTrip> ResetTrip;
|
|
ResetTrip * trip_reset = memories::instance_object<ResetTrip>( env.static_setup_ma, *trip, *not_tripped );
|
|
|
|
typedef systemic::IFunctor<bool> ActionStatus;
|
|
env.rholder.share< ActionStatus >( *trip_reset, links.reset_action );
|
|
|
|
}
|
|
|
|
application::board::PwmTripController::PwmTripController(
|
|
const Links & links ) : links(links) {}
|