MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/application/drivers/BinaryEncoder.hh
2024-06-07 11:12:56 +03:00

54 lines
1.9 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* BinaryEncoder.hh
*
* Created on: 23 июн. 2023 г.
* Author: titov
*/
#ifndef UMLIBRARY_APPLICATION_DRIVERS_BINARYENCODER_HH_
#define UMLIBRARY_APPLICATION_DRIVERS_BINARYENCODER_HH_
#include "../ISetupStep.hh"
#include "../../communication/format/BinaryDataPublisher.hh"
namespace application { namespace board {
//!Модуль представляет бинарные данные в виде энкодера.
struct BinaryEncoder : public ISetupStep {
::communication::ISubscriberRegistrator * data_master = nullptr;
bool input( Environment & env );
void build( Environment & env );
struct Links {
Environment::Id data_master; //!<Входящий фрейм данных.
Environment::Id encoder; //!<Интерфейс энкодера, синхронизированные по процессу данные.
};
struct Setting {
uint16_t frame_bitsize; //!<Размер данных посылки в битах.
uint16_t frame_bitoffset; //!<Смещение данных посылки в битах.
uint16_t agnle_bitsize:6; //!<Размер данных "угла" в битах в посылке.
uint16_t turn_bitsize:6; //!<Размер данных "оборотов" в битах в посылке.
uint16_t inversion:1; //!<Необходимость инверсии направления вращения [0 - прямое вращение, 1 - инвертированное вращение].
uint16_t encoder_type:3; //!<Тип энкодера: [0 - бинарный код, 1 - код грея]
};
const Links & links;
const Setting & config;
BinaryEncoder( const Links & links, const Setting & config );
};
} /* namespace board */
} /* namespace application */
#endif /* UMLIBRARY_APPLICATION_DRIVERS_BINARYENCODER_HH_ */