46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
|
||
|
||
/*!\file
|
||
* \brief \todo Описание файла.
|
||
*/
|
||
/*
|
||
* InverterSetup.cpp
|
||
*
|
||
* Created on: 19 июн. 2019 г.
|
||
* Author: titov
|
||
*/
|
||
|
||
#include "Inverter.hh"
|
||
|
||
#include "../../driver/InverterSync.hh"
|
||
|
||
bool application::board::Inverter::input( Environment & env ) {
|
||
|
||
return grab( pwm_u, env.rholder.getShared<IPwm>( links.pwm_u ) )
|
||
and grab( pwm_v, env.rholder.getShared<IPwm>( links.pwm_v ) )
|
||
and grab( pwm_w, env.rholder.getShared<IPwm>( links.pwm_w ) )
|
||
and grab( pulse_en, env.rholder.getShared<IDiscreteOutput>( links.pulse_en ) );
|
||
|
||
}
|
||
|
||
void application::board::Inverter::build( Environment & env ) {
|
||
|
||
driver::InverterSync * inverter = memories::instance_object<driver::InverterSync>(
|
||
env.static_object_ma,
|
||
*pwm_u, *pwm_v, *pwm_w, *pulse_en );
|
||
|
||
env.signals.create( links.time_u, inverter->getTa() );
|
||
env.signals.create( links.time_v, inverter->getTb() );
|
||
env.signals.create( links.time_w, inverter->getTc() );
|
||
|
||
env.rholder.share<driver::IInverter>( *inverter, links.inverter );
|
||
|
||
env.statuses.create( links.pulse, inverter->isPulseEnable() );
|
||
|
||
}
|
||
|
||
application::board::Inverter::Inverter( const Links & links ) :
|
||
pwm_u(nullptr), pwm_v(nullptr), pwm_w(nullptr), pulse_en(nullptr),
|
||
links(links) {}
|
||
|