diff options
Diffstat (limited to 'boards')
| -rw-r--r-- | boards/OLIMEX_STM32_E407/board.c | 29 | 
1 files changed, 29 insertions, 0 deletions
| diff --git a/boards/OLIMEX_STM32_E407/board.c b/boards/OLIMEX_STM32_E407/board.c index 59b6e9de6..6c149bbca 100644 --- a/boards/OLIMEX_STM32_E407/board.c +++ b/boards/OLIMEX_STM32_E407/board.c @@ -51,6 +51,35 @@ void __early_init(void) {    stm32_clock_init();
  }
 +#if HAL_USE_SDC
 +/*
 + * Card detection through the card internal pull-up on D3.
 + */
 +bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) {
 +
 +  (void)sdcp;
 +  palSetPadMode(GPIOC, GPIOC_SD_D3, PAL_MODE_INPUT);
 +  if (palReadPad(GPIOC, GPIOC_SD_D3) != PAL_LOW) {
 +    /* Switching the pin to SDIO mode because after detecting the card the
 +       SDC driver will start accessing it.*/
 +    palSetPadMode(GPIOC, GPIOC_SD_D3, PAL_MODE_ALTERNATE(12));
 +    return TRUE;
 +  }
 +  /* Leaving the pin in input mode, it will be polled again.*/
 +  return FALSE;
 +}
 +
 +/*
 + * Card write protection detection is not possible, the card is always
 + * reported as not protected.
 + */
 +bool_t sdc_lld_is_write_protected(SDCDriver *sdcp) {
 +
 +  (void)sdcp;
 +  return FALSE;
 +}
 +#endif /* HAL_USE_SDC */
 +
  /*
   * Board-specific initialization code.
   */
 | 
