123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- // // ******************************************************************
- // // /\ /| @File spi_decoder.h
- // // \ V/ @Brief
- // // | "") @Author lijinwen, ghz005@uni-trend.com.cn
- // // / | @Creation 2024-07-19
- // // / \\ @Modified 2024-07-23
- // // *(__\_\
- // // ******************************************************************
- #pragma once
- #include <vector>
- //#include "../BaseHelper/common_helper.h"
- #include "../edge_pulse_data.h"
- #include "../edge_pulse.h"
- #include "../protocol_decode_base.h"
- #include "spi_decode_options.h"
- #include "spi_decode_result.h"
- namespace Protocol
- {
- class SpiDecoder
- {
- public:
- bool DecodeSpi(const SpiDecodeOptions& options,
- const EdgePulseDataTwoLevels& edge_pulse_data_clk,
- const EdgePulseDataTwoLevels& edge_pulse_data_cs,
- const EdgePulseDataTwoLevels& edge_pulse_data_mosi,
- const EdgePulseDataTwoLevels& edge_pulse_data_miso,
- SpiDecodeResult& decode_result);
- private:
- bool* is_cancel_ptr_ = nullptr;
- std::vector<SpiPacket> packet_infos_ = {};
- bool need_decode_data_ = false;
- bool need_update_view_info_ = false;
- //SpiEnums::FramingMode framing_mode_ = SpiEnums::FramingMode::MODE1;
- int frame_count_ = 8;
- //double idle_time_ = 0.0;
- int32_t data_len_ = 0;
- /*std::vector<uint8_t> miso_data = {};
- std::vector<uint8_t> mosi_data = {};*/
- std::vector<DataPacketInfo> data_packet_info_ = {};
- bool FindStartNode(int32_t& start_index, int32_t& cs_start_index, TwoLevelEdgePulse*& node_cs,
- TwoLevelEdgePulse*& node_clk, Polarity polarity_cs, Polarity polarity_clk) const;
- static bool GetCsBitNextIndex(bool state, int32_t start_index, TwoLevelEdgePulse*& node_cs);
- static bool GetClkEdge(bool state, int32_t& start_index, TwoLevelEdgePulse*& node_clk);
- };
- }
|