73 lines
2.0 KiB
C++
73 lines
2.0 KiB
C++
/*
|
|
* PrimaryEncoderSetup.h
|
|
*
|
|
* Created on: 3 îêò. 2019 ã.
|
|
* Author: user
|
|
*/
|
|
|
|
#ifndef SOURCE_APPLICATION_BOARD_PRIMARYENCODERSETUP_H_
|
|
#define SOURCE_APPLICATION_BOARD_PRIMARYENCODERSETUP_H_
|
|
|
|
#include "../ISetupStep.hh"
|
|
|
|
#include "../../peripheral/ISerialPort.hh"
|
|
#include "../../peripheral/IGpio.hh"
|
|
|
|
namespace application { namespace board {
|
|
|
|
struct PrimaryEncoderSetup : 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 );
|
|
void build( Environment & env );
|
|
|
|
struct Links {
|
|
//Input:
|
|
Environment::Id serial_port_id;
|
|
Environment::GpioId de_pin_id;
|
|
Environment::GpioId power_pin_id;
|
|
Environment::GpioId cs21_id;
|
|
Environment::GpioId cs22_id;
|
|
//Output:
|
|
Environment::Id primary_encoder_id;
|
|
Environment::StatusId data_valid_id;
|
|
Environment::StatusId failure_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 {
|
|
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 max_turn_bit_len;
|
|
uint16_t angle_bit_len;
|
|
uint16_t error_bit_len;
|
|
uint16_t inverse;
|
|
};
|
|
|
|
const Setting & config;
|
|
|
|
PrimaryEncoderSetup( const Links & links,
|
|
const Setting & config,
|
|
const configuration::ProcessConfig & proc );
|
|
};
|
|
|
|
} /* namespace board */
|
|
} /* namespace application */
|
|
|
|
#endif /* SOURCE_APPLICATION_BOARD_PRIMARYENCODERSETUP_H_ */
|