mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
F_DESYNC being deprecated, and FluxSource returns an iterator which can be used to retry reads.
42 lines
923 B
C++
42 lines
923 B
C++
#include "globals.h"
|
|
#include "fluxmap.h"
|
|
#include "fluxsource/fluxsource.h"
|
|
#include "lib/fluxsource/fluxsource.pb.h"
|
|
#include "fmt/format.h"
|
|
|
|
class TestPatternFluxSource : public TrivialFluxSource
|
|
{
|
|
public:
|
|
TestPatternFluxSource(const TestPatternFluxSourceProto& config):
|
|
_config(config)
|
|
{}
|
|
|
|
~TestPatternFluxSource() {}
|
|
|
|
public:
|
|
std::unique_ptr<const Fluxmap> readSingleFlux(int track, int side) override
|
|
{
|
|
auto fluxmap = std::make_unique<Fluxmap>();
|
|
|
|
while (fluxmap->duration() < (_config.sequence_length_us()*1000000.0))
|
|
{
|
|
fluxmap->appendInterval(_config.interval_us());
|
|
fluxmap->appendPulse();
|
|
}
|
|
|
|
return fluxmap;
|
|
}
|
|
|
|
void recalibrate() {}
|
|
|
|
private:
|
|
const TestPatternFluxSourceProto& _config;
|
|
};
|
|
|
|
std::unique_ptr<FluxSource> FluxSource::createTestPatternFluxSource(const TestPatternFluxSourceProto& config)
|
|
{
|
|
return std::make_unique<TestPatternFluxSource>(config);
|
|
}
|
|
|
|
|