From d5cfd83d179d484cb8497c736adb7daf7027efab Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 28 Jun 2012 13:54:19 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4355 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- boards/OLIMEX_STM32_E407/board.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'boards/OLIMEX_STM32_E407/board.c') 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. */ -- cgit v1.2.3