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
| 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 |
| 292 | CommonBridgeTemplate::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 |
no test coverage detected