MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / readData

Method readData

external/floppybridge/src/ArduinoFloppyBridge.cpp:292–305  ·  view source on GitHub ↗

Called when data should be read from the drive. pll: supplied if you use it maxBufferSize: Maximum number of RotationExtractor::MFMSample in the buffer. If we're trying to detect a disk, this might be set VERY LOW buffer: Where to save to. When a buffer is saved, position 0 MUST be where the INDEX pulse is. RevolutionExtractor will do this for you indexMarker: Used by rotationEx

Source from the content-addressed store, hash-verified

290// onRotation: A function you should call for each complete revolution received. If the function returns FALSE then you should abort reading, else keep sending revolutions
291// Returns: ReadResponse, explains its self
292CommonBridgeTemplate::ReadResponse ArduinoFloppyDiskBridge::readData(PLL::BridgePLL& pll, const unsigned int maxBufferSize, RotationExtractor::MFMSample* buffer, RotationExtractor::IndexSequenceMarker& indexMarker,
293 std::function<bool(RotationExtractor::MFMSample* mfmData, const unsigned int dataLengthInBits)> onRotation) {
294
295 ArduinoFloppyReader::DiagnosticResponse result = m_io.readRotation(*pll.rotationExtractor(), maxBufferSize, buffer, indexMarker,
296 [&onRotation](RotationExtractor::MFMSample** mfmData, const unsigned int dataLengthInBits) -> bool {
297 return onRotation(*mfmData, dataLengthInBits);
298 }, true);
299
300 switch (result) {
301 case ArduinoFloppyReader::DiagnosticResponse::drOK: return ReadResponse::rrOK;
302 case ArduinoFloppyReader::DiagnosticResponse::drNoDiskInDrive: return ReadResponse::rrNoDiskInDrive;
303 default: return ReadResponse::rrError;
304 }
305}
306
307// Called for a direct read. This does not match up a rotation and should be used with the pll initialized with the LinearExtractor
308// pll: required

Callers 1

readLinearDataMethod · 0.45

Calls 2

rotationExtractorMethod · 0.80
readRotationMethod · 0.45

Tested by

no test coverage detected