64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
/*
|
|
* QuadratureEncoderSetup.h
|
|
*
|
|
* Created on: 22 ÿíâ. 2020 ã.
|
|
* Author: user
|
|
*/
|
|
|
|
#ifndef UMLIBRARY_APPLICATION_BOARD_QUADRATUREENCODERSETUP_H_
|
|
#define UMLIBRARY_APPLICATION_BOARD_QUADRATUREENCODERSETUP_H_
|
|
|
|
#include "../ISetupStep.hh"
|
|
|
|
#include "../../peripheral/IGpio.hh"
|
|
#include "../../peripheral/ICounter.hh"
|
|
|
|
namespace application {
|
|
namespace board {
|
|
|
|
struct QuadratureEncoderSetup: public ISetupStep {
|
|
peripheral::IGpio * gpio_sel1;
|
|
peripheral::IGpio * gpio_sel2;
|
|
peripheral::ICounter * counter;
|
|
|
|
bool input( Environment & env );
|
|
|
|
void build( Environment & env );
|
|
|
|
struct Links {
|
|
//Input:
|
|
uint16_t counter_id;
|
|
Environment::GpioId sel1_pin_id;
|
|
Environment::GpioId sel2_pin_id;
|
|
//Output:
|
|
uint16_t encoder_id;
|
|
Environment::StatusId failure_id;
|
|
Environment::SignalId encoder_angle_sig_id; //!<Óãîë ïî äàííûì ýíêîäåðà.
|
|
Environment::SignalId encoder_turn_sig_id; //!<Îáîðîò ïî äàííûì ýíêîäåðà.
|
|
};
|
|
|
|
const Links & links;
|
|
|
|
const configuration::ProcessConfig & params;
|
|
|
|
struct Setting {
|
|
uint16_t sel1_active_level;
|
|
uint16_t sel2_active_level;
|
|
|
|
uint16_t max_turn_value;
|
|
uint16_t line_in_turn;
|
|
};
|
|
|
|
const Setting & config;
|
|
|
|
QuadratureEncoderSetup( const Links & links,
|
|
const Setting & config,
|
|
const configuration::ProcessConfig & proc );
|
|
|
|
};
|
|
|
|
} /* namespace board */
|
|
} /* namespace application */
|
|
|
|
#endif /* UMLIBRARY_APPLICATION_BOARD_QUADRATUREENCODERSETUP_H_ */
|