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

36 lines
756 B
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.

/*
* SpiPortReader.hpp
*
* Created on: 13 нояб. 2019 г.
* Author: user
*/
#ifndef SOURCE_DRIVER_SPIPORTREADER_HPP_
#define SOURCE_DRIVER_SPIPORTREADER_HPP_
#include "SpiPortRoutineOperation.hpp"
#include <cstddef>
#include <stdint.h>
namespace driver {
template<typename Frame>
struct SpiPortReader {
typedef uint16_t Latency;
Latency latency;
typedef driver::SpiOperationPack<Frame, Latency> Operation;
Operation get_op;
Frame get() { return (get_op() ? get_op() : 0), get_op.output; }
SpiPortReader( peripheral::ISerialPort & port, std::size_t frame_size, Frame request_frame )
: get_op(port, frame_size, request_frame, latency), latency(0) {}
};
}
#endif /* SOURCE_DRIVER_SPIPORTREADER_HPP_ */