Skip to content

Commit

Permalink
Merge pull request #34 from alpo/select-fix
Browse files Browse the repository at this point in the history
fix name conflict with sys/select.h  (fixes issue #32)
  • Loading branch information
MaJerle authored Apr 19, 2019
2 parents af54e41 + b3add4e commit 3f8b3a0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions 00-STM32_LIBRARIES/fatfs/drivers/fatfs_sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,23 @@ static int wait_ready ( /* 1:Ready, 0:Timeout */
/*-----------------------------------------------------------------------*/
/* Deselect card and release SPI */
/*-----------------------------------------------------------------------*/
static void deselect (void) {
static void deselect_card (void) {
FATFS_CS_HIGH; /* CS = H */
TM_SPI_Send(FATFS_SPI, 0xFF); /* Dummy clock (force DO hi-z for multiple slave SPI) */
}

/*-----------------------------------------------------------------------*/
/* Select card and wait for ready */
/*-----------------------------------------------------------------------*/
static int select (void) /* 1:OK, 0:Timeout */
static int select_card (void) /* 1:OK, 0:Timeout */
{
FATFS_CS_LOW;
TM_SPI_Send(FATFS_SPI, 0xFF); /* Dummy clock (force DO enabled) */

if (wait_ready(500)) {
return 1; /* OK */
}
deselect();
deselect_card();
return 0; /* Timeout */
}

Expand Down Expand Up @@ -237,8 +237,8 @@ static BYTE send_cmd ( /* Return value: R1 resp (bit7==1:Failed to send) */

/* Select the card and wait for ready except to stop multiple block read */
if (cmd != CMD12) {
deselect();
if (!select()) return 0xFF;
deselect_card();
if (!select_card()) return 0xFF;
}

/* Send command packet */
Expand Down Expand Up @@ -323,7 +323,7 @@ DSTATUS TM_FATFS_SD_disk_initialize (void) {
}
}
TM_FATFS_SD_CardType = ty; /* Card type */
deselect();
deselect_card();

if (ty) { /* OK */
TM_FATFS_SD_Stat &= ~STA_NOINIT; /* Clear STA_NOINIT flag */
Expand Down Expand Up @@ -391,7 +391,7 @@ DRESULT TM_FATFS_SD_disk_read (
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
}
}
deselect();
deselect_card();

return count ? RES_ERROR : RES_OK; /* Return result */
}
Expand Down Expand Up @@ -440,7 +440,7 @@ DRESULT TM_FATFS_SD_disk_write (
}
}
}
deselect();
deselect_card();

return count ? RES_ERROR : RES_OK; /* Return result */
}
Expand Down Expand Up @@ -470,7 +470,7 @@ DRESULT TM_FATFS_SD_disk_ioctl (

switch (cmd) {
case CTRL_SYNC : /* Wait for end of internal write process of the drive */
if (select()) res = RES_OK;
if (select_card()) res = RES_OK;
break;

/* Size in bytes for single sector */
Expand Down Expand Up @@ -531,7 +531,7 @@ DRESULT TM_FATFS_SD_disk_ioctl (
res = RES_PARERR;
}

deselect();
deselect_card();

return res;
}
Expand Down

0 comments on commit 3f8b3a0

Please sign in to comment.