mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Rename FluxReader and FluxWriter to FluxSource and FluxSink.
This commit is contained in:
46
lib/fluxsink/hardwarefluxsink.cc
Normal file
46
lib/fluxsink/hardwarefluxsink.cc
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "globals.h"
|
||||
#include "flags.h"
|
||||
#include "fluxmap.h"
|
||||
#include "usb.h"
|
||||
#include "fluxsink.h"
|
||||
|
||||
static bool high_density = false;
|
||||
|
||||
void setHardwareFluxSinkDensity(bool high_density)
|
||||
{
|
||||
::high_density = high_density;
|
||||
}
|
||||
|
||||
class HardwareFluxSink : public FluxSink
|
||||
{
|
||||
public:
|
||||
HardwareFluxSink(unsigned drive):
|
||||
_drive(drive)
|
||||
{
|
||||
}
|
||||
|
||||
~HardwareFluxSink()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
void writeFlux(int track, int side, Fluxmap& fluxmap)
|
||||
{
|
||||
usbSetDrive(_drive, high_density);
|
||||
usbSeek(track);
|
||||
|
||||
Bytes crunched = fluxmap.rawBytes().crunch();
|
||||
return usbWrite(side, crunched);
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned _drive;
|
||||
};
|
||||
|
||||
std::unique_ptr<FluxSink> FluxSink::createHardwareFluxSink(unsigned drive)
|
||||
{
|
||||
return std::unique_ptr<FluxSink>(new HardwareFluxSink(drive));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user