mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
sd card: fix SD R1 detection
SD R1 response format is defined as any byte with the MSb cleared. The code was testing for any byte that was not 0xFF which can lead to misinterpreting a byte as the response. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@998 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
5c230e734d
commit
1169514bf9
@ -365,7 +365,7 @@ int32_t PIOS_SDCARD_SendSDCCmd(uint8_t cmd, uint32_t addr, uint8_t crc)
|
||||
} else {
|
||||
/* Wait for standard R1 response */
|
||||
for(i = 0; i < 8; ++i) {
|
||||
if((ret = PIOS_SPI_TransferByte(PIOS_SDCARD_SPI, 0xff)) != 0xff ) {
|
||||
if(!((ret = PIOS_SPI_TransferByte(PIOS_SDCARD_SPI, 0xff)) & 0x80) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user