75 lines
2.1 KiB
C++
75 lines
2.1 KiB
C++
/*
|
||
* SecondaryEncoderSetup.h
|
||
*
|
||
* Created on: 20 мар. 2019 г.
|
||
* Author: krugliy
|
||
*/
|
||
|
||
#ifndef SOURCE_APPLICATION_BOARD_SECONDARYENCODERSETUP_HH_
|
||
#define SOURCE_APPLICATION_BOARD_SECONDARYENCODERSETUP_HH_
|
||
|
||
#include "../ISetupStep.hh"
|
||
|
||
#include "../../peripheral/ISerialPort.hh"
|
||
#include "../../peripheral/IGpio.hh"
|
||
|
||
namespace application { namespace board {
|
||
|
||
struct SecondaryEncoderSetup : public ISetupStep {
|
||
|
||
peripheral::ISerialPort * serial_port = nullptr;
|
||
peripheral::IGpio * de_pin = nullptr;
|
||
peripheral::IGpio * power_pin = nullptr;
|
||
peripheral::IGpio * cs21_pin = nullptr;
|
||
peripheral::IGpio * cs22_pin = nullptr;
|
||
|
||
bool input( Environment & env );
|
||
bool prepare();
|
||
void build( Environment & env );
|
||
|
||
struct Links {
|
||
//Input:
|
||
uint16_t serial_port_id;
|
||
Environment::GpioId de_pin_id;
|
||
Environment::GpioId power_pin_id;
|
||
Environment::GpioId cs21_id;
|
||
Environment::GpioId cs22_id;
|
||
//Output:
|
||
uint16_t secondary_encoder_id;
|
||
|
||
//Temp signal id:
|
||
Environment::SignalId encoder_angle_sig_id; //!<Угол по данным энкодера.
|
||
Environment::SignalId encoder_turn_sig_id; //!<Оборот по данным энкодера.
|
||
Environment::SignalId encoder_err_sig_id; //!<Код ошибки энкодера.
|
||
};
|
||
|
||
const Links & links;
|
||
|
||
const configuration::ProcessConfig & params;
|
||
|
||
struct Setting {
|
||
float update_period; //!<Время обновления порта в с.
|
||
|
||
uint16_t de_active_level;
|
||
uint16_t power_pin_active_level;
|
||
uint16_t cs21_active_level;
|
||
uint16_t cs22_active_level;
|
||
|
||
uint16_t shift_bit_count;
|
||
uint16_t turn_bit_len;
|
||
uint16_t angle_bit_len;
|
||
uint16_t error_bit_len;
|
||
};
|
||
|
||
const Setting & config;
|
||
|
||
SecondaryEncoderSetup( const Links & links,
|
||
const Setting & config,
|
||
const configuration::ProcessConfig & proc );
|
||
};
|
||
|
||
} /* namespace board */
|
||
} /* namespace application */
|
||
|
||
#endif /* SOURCE_APPLICATION_BOARD_SECONDARYENCODERSETUP_HH_ */
|