MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/driver/BiSSCAdaperLogic.hh
2024-06-07 11:12:56 +03:00

65 lines
2.7 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.

/*
* BiSSCAdaperLogic.hh
*
* Created on: 3 сент. 2021 г.
* Author: sozonov
*/
#ifndef UMLIBRARY_DRIVER_BISSCADAPERLOGIC_HH_
#define UMLIBRARY_DRIVER_BISSCADAPERLOGIC_HH_
#include <stdint.h>
#include "../peripheral/ISerialPort.hh"
namespace driver {
class BiSSCAdapterLogic : public peripheral::ISerialPort {
public:
explicit BiSSCAdapterLogic (peripheral::ISerialPort * _isp_source, uint16_t _ACK_bits, uint16_t _line_delay, uint16_t _inv );
explicit BiSSCAdapterLogic (peripheral::ISerialPort * _isp_source, uint16_t _ACK_bits, uint16_t _line_delay, uint16_t _master_bit_count, uint16_t _two_bits_wait,
uint16_t _start_bits, uint16_t _cbs_bits );
//peripheral::ISerialPort override functions:
virtual bool transmite( const void * bit_stream, int bit_count ) override;
virtual bool receive( void * data ) override;
virtual bool isDataReady() override;
/*!Функция разбора входящего BiSS-C пакета данных.
*
* @param data - полный пакет данных, вместе с системными битами, которые необходимо отсечь
* @return fE - флаг "правильности" поставляемых данных, 1/0 - верный/неверный пакет данных
*/
bool parceMessage( uint16_t * data );
const bool & getfE () { return fE; };
private:
peripheral::ISerialPort * isp_source; //<! Интерфейс входных данных последовательного порта.
uint16_t master_bits_count; //<! Количество бит, которые запросил мастер.
const uint16_t line_delay; //<! Биты компенсации задержки на линии.
const uint16_t two_bits_wait; //<! Два бита ожидания, в соответствии с протоколом.
const uint16_t ACK_bits; //<! Количество нулевых бит.
const uint16_t start_bits; //<! Количество стартовых бит.
const uint16_t cbs_bits; //<! Бит ответа от слейва (control bit slave).
const uint16_t f_inversion; //<! Флаг инверсии входных данных. ( 0/1 - не инвертированы/ инвертированы)
bool fE; //<! Флаг ошибки полученного пакета данных.
const uint16_t tech_bits_size;
uint16_t size_of_array;
uint16_t num_of_cpy_byte;
uint16_t buf_data_array[32];
};
} /* namespace driver */
#endif /* UMLIBRARY_DRIVER_BISSCADAPERLOGIC_HH_ */