@@ -354,6 +354,15 @@ uint8_t BSP_SD_DeInit(void)
354
354
/* Msp SD deinitialization */
355
355
BSP_SD_MspDeInit (& uSdHandle , NULL );
356
356
357
+
358
+ if (SD_detect_ll_gpio_pin != LL_GPIO_PIN_ALL ) {
359
+ BSP_SD_Detect_MspDeInit (& uSdHandle , NULL );
360
+ }
361
+ #if defined(USE_SD_TRANSCEIVER ) && (USE_SD_TRANSCEIVER != 0U )
362
+ BSP_SD_Transceiver_MspDeInit (& uSdHandle , NULL );
363
+ #endif
364
+
365
+
357
366
return sd_state ;
358
367
}
359
368
@@ -523,26 +532,6 @@ __weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
523
532
#endif
524
533
}
525
534
526
- /**
527
- * @brief Initializes the SD Detect pin MSP.
528
- * @param hsd: SD handle
529
- * @param Params : pointer on additional configuration parameters, can be NULL.
530
- */
531
- __weak void BSP_SD_Detect_MspInit (SD_HandleTypeDef * hsd , void * Params )
532
- {
533
- UNUSED (hsd );
534
- UNUSED (Params );
535
-
536
- /* GPIO configuration in input for uSD_Detect signal */
537
- #ifdef LL_GPIO_SPEED_FREQ_VERY_HIGH
538
- LL_GPIO_SetPinSpeed (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_SPEED_FREQ_VERY_HIGH );
539
- #else
540
- LL_GPIO_SetPinSpeed (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_SPEED_FREQ_HIGH );
541
- #endif
542
- LL_GPIO_SetPinMode (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_MODE_INPUT );
543
- LL_GPIO_SetPinPull (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_PULL_UP );
544
- }
545
-
546
535
/**
547
536
* @brief DeInitializes the SD MSP.
548
537
* @param hsd: SD handle
@@ -608,6 +597,42 @@ __weak void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params)
608
597
#endif
609
598
}
610
599
600
+ /**
601
+ * @brief Initializes the SD Detect pin MSP.
602
+ * @param hsd: SD handle
603
+ * @param Params : pointer on additional configuration parameters, can be NULL.
604
+ */
605
+ __weak void BSP_SD_Detect_MspInit (SD_HandleTypeDef * hsd , void * Params )
606
+ {
607
+ UNUSED (hsd );
608
+ UNUSED (Params );
609
+
610
+ /* GPIO configuration in input for uSD_Detect signal */
611
+ #ifdef LL_GPIO_SPEED_FREQ_VERY_HIGH
612
+ LL_GPIO_SetPinSpeed (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_SPEED_FREQ_VERY_HIGH );
613
+ #else
614
+ LL_GPIO_SetPinSpeed (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_SPEED_FREQ_HIGH );
615
+ #endif
616
+ LL_GPIO_SetPinMode (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_MODE_INPUT );
617
+ LL_GPIO_SetPinPull (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_PULL_UP );
618
+ }
619
+
620
+ /**
621
+ * @brief DeInitializes the SD Detect pin MSP.
622
+ * @param hsd: SD handle
623
+ * @param Params : pointer on additional configuration parameters, can be NULL.
624
+ */
625
+ __weak void BSP_SD_Detect_MspDeInit (SD_HandleTypeDef * hsd , void * Params )
626
+ {
627
+ UNUSED (hsd );
628
+ UNUSED (Params );
629
+
630
+ /* GPIO configuration in analog to saves the consumption */
631
+ LL_GPIO_SetPinSpeed (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_SPEED_FREQ_LOW );
632
+ LL_GPIO_SetPinPull (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_PULL_NO );
633
+ LL_GPIO_SetPinMode (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_MODE_ANALOG );
634
+ }
635
+
611
636
#if defined(USE_SD_TRANSCEIVER ) && (USE_SD_TRANSCEIVER != 0U )
612
637
/**
613
638
* @brief Initializes the SD Transceiver pin MSP.
@@ -634,6 +659,25 @@ __weak void BSP_SD_Transceiver_MspInit(SD_HandleTypeDef *hsd, void *Params)
634
659
LL_GPIO_ResetOutputPin (SD_trans_sel_gpio_port , SD_trans_sel_ll_gpio_pin );
635
660
}
636
661
662
+ /**
663
+ * @brief DeInitializes the SD Transceiver pin MSP.
664
+ * @param hsd: SD handle
665
+ * @param Params : pointer on additional configuration parameters, can be NULL.
666
+ */
667
+ __weak void BSP_SD_Transceiver_MspDeInit (SD_HandleTypeDef * hsd , void * Params )
668
+ {
669
+ UNUSED (hsd );
670
+ UNUSED (Params );
671
+
672
+ LL_GPIO_SetPinSpeed (SD_trans_en_gpio_port , SD_trans_en_ll_gpio_pin , LL_GPIO_SPEED_FREQ_LOW );
673
+ LL_GPIO_SetPinMode (SD_trans_en_gpio_port , SD_trans_en_ll_gpio_pin , LL_GPIO_MODE_ANALOG );
674
+ LL_GPIO_SetPinPull (SD_trans_en_gpio_port , SD_trans_en_ll_gpio_pin , LL_GPIO_PULL_NO );
675
+
676
+ LL_GPIO_SetPinSpeed (SD_trans_sel_gpio_port , SD_trans_sel_ll_gpio_pin , LL_GPIO_SPEED_FREQ_LOW );
677
+ LL_GPIO_SetPinMode (SD_trans_sel_gpio_port , SD_trans_sel_ll_gpio_pin , LL_GPIO_MODE_ANALOG );
678
+ LL_GPIO_SetPinPull (SD_trans_sel_gpio_port , SD_trans_sel_ll_gpio_pin , LL_GPIO_PULL_NO );
679
+ }
680
+
637
681
/**
638
682
* @brief Enable/Disable the SD Transceiver 1.8V Mode Callback.
639
683
* @param status: Voltage Switch State
0 commit comments