45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
/*
|
|
* SerialPacketReaderInitializer.cpp
|
|
*
|
|
* Created on: 17 äåê. 2021 ã.
|
|
* Author: titov
|
|
*/
|
|
|
|
#include "SerialPacketReader.hh"
|
|
|
|
#include "../../communication/IBinaryDataSubscriber.hh"
|
|
#include "../../driver/SerialPacketReader.hh"
|
|
|
|
|
|
|
|
bool application::board::SerialPacketReader::input( Environment & env ) {
|
|
|
|
return grab( memory_resource, env.rholder.getShared<std::pmr::memory_resource>( links.data_memory ) ) and
|
|
grab( serial_port, env.rholder.getShared<peripheral::ISerialPort>( links.serial_port ) ) and
|
|
grab( binary_data, env.rholder.getShared<communication::IBinaryDataSubscriber>( links.binary_data ) );
|
|
|
|
}
|
|
|
|
void application::board::SerialPacketReader::build( Environment & env ) {
|
|
|
|
typedef ::driver::SerialPacketReader SPR;
|
|
|
|
std::size_t bitsize = config.bit_size;
|
|
bool need_reverse = config.data_reverse;
|
|
|
|
SPR * spr = memories::instance_object<SPR>( env.static_data_ma, *serial_port, *binary_data, memory_resource, bitsize, need_reverse );
|
|
|
|
systemic::ProcScheduler::ProcessParameter proc = {
|
|
.priority = params.priority,
|
|
.period = params.period, .phase = params.phase,
|
|
.controlled = false
|
|
};
|
|
|
|
env.scheduler.registerProcess( params.processor_id, *spr,
|
|
proc );
|
|
|
|
}
|
|
|
|
application::board::SerialPacketReader::SerialPacketReader( const Links & links, const Setting & config, const configuration::ProcessConfig & proc) :
|
|
links(links), config(config), params(proc) {}
|