39 lines
956 B
C++
39 lines
956 B
C++
/*
|
||
* DemuxSetup.cpp
|
||
*
|
||
* Created on: 23 окт. 2019 г.
|
||
* Author: user
|
||
*/
|
||
|
||
#include "DemuxSetup.hh"
|
||
|
||
#include "../../driver/Demux.hh"
|
||
|
||
bool application::virtualization::DemuxSetup::input( Environment & env ) {
|
||
|
||
return grab( gpio_port, env.rholder.getShared< peripheral::IPort >( links.gpio_port_id ) );
|
||
|
||
}
|
||
|
||
void application::virtualization::DemuxSetup::build( Environment & env ) {
|
||
|
||
driver::Demux::SelectPinStrategy strategy = static_cast<driver::Demux::SelectPinStrategy>( config.pin_set_strategy );
|
||
|
||
if( links.demux_id ) {
|
||
|
||
driver::Demux * demux = memories::instance_object<driver::Demux>(
|
||
env.static_object_ma,
|
||
*gpio_port,
|
||
config.pin_mask,
|
||
strategy
|
||
);
|
||
|
||
env.rholder.share( *demux, links.demux_id );
|
||
|
||
}
|
||
|
||
}
|
||
|
||
application::virtualization::DemuxSetup::DemuxSetup( const Links & links, const Setting & config )
|
||
: links(links), config(config) {}
|