Checks the pins from boards that support it
| 342 | |
| 343 | // Checks the pins from boards that support it |
| 344 | bool SCPInterface::checkPins() { |
| 345 | SCPResponse response; |
| 346 | |
| 347 | selectDrive(true); |
| 348 | bool ret = sendCommand(SCPCommand::DoCMD_STATUS, response); |
| 349 | |
| 350 | if (!ret) { |
| 351 | if (!m_motorIsEnabled) selectDrive(false); |
| 352 | return false; |
| 353 | } |
| 354 | |
| 355 | unsigned char bytes[2]; |
| 356 | if (m_comPort.read(bytes, 2) != 2) { |
| 357 | if (!m_motorIsEnabled) selectDrive(false); |
| 358 | return false; |
| 359 | } |
| 360 | if (!m_motorIsEnabled) selectDrive(false); |
| 361 | |
| 362 | uint16_t status = (bytes[1] | (bytes[0] << 8)); |
| 363 | m_isWriteProtected = (status & (1 << 7)) == 0; |
| 364 | m_diskInDrive = (status & (1 << 6)) !=0; |
| 365 | m_isAtTrack0 = (status & (1 << 5)) == 0; |
| 366 | return true; |
| 367 | } |
| 368 | |
| 369 | // Search for track 0 |
| 370 | bool SCPInterface::findTrack0() { |