84 lines
2.7 KiB
C++
84 lines
2.7 KiB
C++
/*!\file
|
||
* \brief \todo Описание файла.
|
||
*/
|
||
/*
|
||
* DiscreteOutputSetup.h
|
||
*
|
||
* Created on: 2 июл. 2019 г.
|
||
* Author: titov
|
||
*/
|
||
|
||
#ifndef SOURCE_APPLICATION_raw_signals_DISCRETEOUTPUTSETUP_H_
|
||
#define SOURCE_APPLICATION_raw_signals_DISCRETEOUTPUTSETUP_H_
|
||
|
||
#include "../ISetupStep.hh"
|
||
|
||
#include "../../peripheral/IGpio.hh"
|
||
#include "../../driver/IDiscreteOutput.hh"
|
||
|
||
#include <exception>
|
||
|
||
namespace application { namespace board {
|
||
|
||
//!Дискретный выход на основе аппаратного вывода.
|
||
struct DiscreteOutputGpio : public ISetupStep {
|
||
|
||
typedef peripheral::IGpio IGpio;
|
||
typedef driver::IDiscreteOutput IDiscreteOutput;
|
||
|
||
IGpio * pin = nullptr;
|
||
|
||
bool input( Environment & env );
|
||
void build( Environment & env );
|
||
|
||
struct Links {
|
||
Environment::GpioId pin; //!<Вывод в режиме дискретного выхода.
|
||
Environment::Id discrete_output; //!<Дискретный выход.
|
||
};
|
||
|
||
struct Setting {
|
||
bool activation_level; //!<Уровень аппаратного вывода, соотвествующий активации дискретного выхода.
|
||
};
|
||
|
||
const Links & links;
|
||
const Setting & cfg;
|
||
|
||
DiscreteOutputGpio( const Links & links, const Setting & cfg );
|
||
};
|
||
|
||
//!Дискретный выход работающий с двумя дублирующими аппаратными выводами.
|
||
struct DiscreteOutputDoubleGpio : public ISetupStep {
|
||
|
||
typedef peripheral::IGpio IGpio;
|
||
typedef driver::IDiscreteOutput IDiscreteOutput;
|
||
|
||
IGpio * pin_a = nullptr;
|
||
IGpio * pin_b = nullptr;
|
||
|
||
bool input( Environment & env );
|
||
void build( Environment & env );
|
||
|
||
struct Links {
|
||
Environment::GpioId pin_a; //!<Аппаратный вывод "a" в режиме дискретного выхода.
|
||
Environment::GpioId pin_b; //!<Аппаратный вывод "b" в режиме дискретного выхода.
|
||
Environment::Id discrete_output; //!<Дискретный выход.
|
||
};
|
||
|
||
struct Setting {
|
||
bool activation_level_a; //!<Уровень аппаратного вывода "a", соотвествующий активации дискретного выхода.
|
||
bool activation_level_b; //!<Уровень аппаратного вывода "b", соотвествующий активации дискретного выхода.
|
||
};
|
||
|
||
const Links & links;
|
||
const Setting & cfg;
|
||
|
||
DiscreteOutputDoubleGpio( const Links & links, const Setting & cfg );
|
||
};
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|
||
#endif /* SOURCE_APPLICATION_raw_signals_DISCRETEOUTPUTSETUP_H_ */
|