aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/ARMCM3-STM32F103ZG-FATFS/main.c17
-rw-r--r--os/hal/platforms/STM32/sdc_lld.h1
2 files changed, 16 insertions, 2 deletions
diff --git a/demos/ARMCM3-STM32F103ZG-FATFS/main.c b/demos/ARMCM3-STM32F103ZG-FATFS/main.c
index 374cf7c4a..f8608ffeb 100644
--- a/demos/ARMCM3-STM32F103ZG-FATFS/main.c
+++ b/demos/ARMCM3-STM32F103ZG-FATFS/main.c
@@ -51,9 +51,22 @@ static EventSource inserted_event, removed_event;
*
* @notapi
*/
-static bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) {
+bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) {
- return TRUE;
+ return !palReadPad(GPIOF, GPIOF_SD_DETECT);
+}
+
+/**
+ * @brief Protection detection.
+ * @note Not supported.
+ *
+ * @param[in] sdcp pointer to the @p SDCDriver object
+ *
+ * @notapi
+ */
+bool_t sdc_lld_is_write_protected(SDCDriver *sdcp) {
+
+ return FALSE;
}
/**
diff --git a/os/hal/platforms/STM32/sdc_lld.h b/os/hal/platforms/STM32/sdc_lld.h
index a856fbf2b..5466eacad 100644
--- a/os/hal/platforms/STM32/sdc_lld.h
+++ b/os/hal/platforms/STM32/sdc_lld.h
@@ -190,6 +190,7 @@ extern "C" {
uint8_t *buf, uint32_t n);
bool_t sdc_lld_write(SDCDriver *sdcp, uint32_t startblk,
const uint8_t *buf, uint32_t n);
+ bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp);
bool_t sdc_lld_is_write_protected(SDCDriver *sdcp);
#ifdef __cplusplus
}