84 lines
2.2 KiB
C++
84 lines
2.2 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_ */
|