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

Method checkPins

external/floppybridge/src/GreaseWeazleInterface.cpp:385–422  ·  view source on GitHub ↗

Checks the pins from boards that support it

Source from the content-addressed store, hash-verified

383
384// Checks the pins from boards that support it
385bool GreaseWeazleInterface::checkPins() {
386 Ack response;
387 selectDrive(true);
388
389 if ((!sendCommand(Cmd::GetPin, PIN_WRPROT, response)) || (response != Ack::Okay)) {
390 m_pinWrProtectAvailable = false;
391 if (response == Ack::BadCommand) return false;
392 }
393 else {
394 unsigned char value = 0;
395 unsigned long read = m_comPort.read(&value, 1);
396 if (read == 1) {
397 m_pinWrProtectAvailable = true;
398 m_isWriteProtected = value == 0;
399 }
400 }
401
402 if (m_currentBusType == BusType::Shugart) {
403 m_pinDskChangeAvailable = false; // not supported by Greaseweazle on Pin 2
404 }
405 else {
406 if ((!sendCommand(Cmd::GetPin, PIN_DISKCHG_IBMPC, response)) || (response != Ack::Okay)) {
407 m_pinDskChangeAvailable = false;
408 if (response == Ack::BadCommand) return false;
409 }
410 else {
411 unsigned char value = 0;
412 unsigned long read = m_comPort.read(&value, 1);
413 if (read == 1) {
414 m_pinDskChangeAvailable = true;
415 m_diskInDrive = value == 1;
416 }
417 }
418 }
419
420 if (!m_motorIsEnabled) selectDrive(false);
421 return true;
422}
423
424// Search for track 0
425GWResponse GreaseWeazleInterface::findTrack0() {

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected