@@ -381,13 +381,14 @@ uint8_t BSP_SD_TransceiverPin(GPIO_TypeDef *enport, uint32_t enpin, GPIO_TypeDef
381
381
382
382
/**
383
383
* @brief Set the SD card device detect pin, port and level.
384
- * @param port one of the gpio port
385
- * @param pin one of the gpio pin
384
+ * @param p PinName of the detect pin
386
385
* @param level the level of the detect pin (HIGH or LOW)
387
386
* @retval SD status
388
387
*/
389
- uint8_t BSP_SD_DetectPin (GPIO_TypeDef * port , uint32_t pin , uint32_t level )
388
+ uint8_t BSP_SD_DetectPin (PinName p , uint32_t level )
390
389
{
390
+ GPIO_TypeDef * port = set_GPIO_Port_Clock (STM_PORT (p ));
391
+ uint32_t pin = STM_LL_GPIO_PIN (p );
391
392
if (port != 0 ) {
392
393
SD_detect_ll_gpio_pin = pin ;
393
394
SD_detect_gpio_port = port ;
@@ -397,75 +398,6 @@ uint8_t BSP_SD_DetectPin(GPIO_TypeDef *port, uint32_t pin, uint32_t level)
397
398
return MSD_ERROR ;
398
399
}
399
400
400
- /**
401
- * @brief Configures Interrupt mode for SD detection pin.
402
- * @retval Status
403
- */
404
- uint8_t BSP_SD_DetectITConfig (void (* callback )(void ))
405
- {
406
- uint8_t sd_state = MSD_ERROR ;
407
- if (SD_detect_ll_gpio_pin != LL_GPIO_PIN_ALL ) {
408
- LL_GPIO_SetPinPull (SD_detect_gpio_port , SD_detect_ll_gpio_pin , LL_GPIO_PULL_UP );
409
- uint16_t SD_detect_gpio_pin = GPIO_PIN_All ;
410
- switch (SD_detect_ll_gpio_pin ) {
411
- case LL_GPIO_PIN_0 :
412
- SD_detect_gpio_pin = GPIO_PIN_0 ;
413
- break ;
414
- case LL_GPIO_PIN_1 :
415
- SD_detect_gpio_pin = GPIO_PIN_1 ;
416
- break ;
417
- case LL_GPIO_PIN_2 :
418
- SD_detect_gpio_pin = GPIO_PIN_2 ;
419
- break ;
420
- case LL_GPIO_PIN_3 :
421
- SD_detect_gpio_pin = GPIO_PIN_3 ;
422
- break ;
423
- case LL_GPIO_PIN_4 :
424
- SD_detect_gpio_pin = GPIO_PIN_4 ;
425
- break ;
426
- case LL_GPIO_PIN_5 :
427
- SD_detect_gpio_pin = GPIO_PIN_5 ;
428
- break ;
429
- case LL_GPIO_PIN_6 :
430
- SD_detect_gpio_pin = GPIO_PIN_6 ;
431
- break ;
432
- case LL_GPIO_PIN_7 :
433
- SD_detect_gpio_pin = GPIO_PIN_7 ;
434
- break ;
435
- case LL_GPIO_PIN_8 :
436
- SD_detect_gpio_pin = GPIO_PIN_8 ;
437
- break ;
438
- case LL_GPIO_PIN_9 :
439
- SD_detect_gpio_pin = GPIO_PIN_9 ;
440
- break ;
441
- case LL_GPIO_PIN_10 :
442
- SD_detect_gpio_pin = GPIO_PIN_10 ;
443
- break ;
444
- case LL_GPIO_PIN_11 :
445
- SD_detect_gpio_pin = GPIO_PIN_11 ;
446
- break ;
447
- case LL_GPIO_PIN_12 :
448
- SD_detect_gpio_pin = GPIO_PIN_12 ;
449
- break ;
450
- case LL_GPIO_PIN_13 :
451
- SD_detect_gpio_pin = GPIO_PIN_13 ;
452
- break ;
453
- case LL_GPIO_PIN_14 :
454
- SD_detect_gpio_pin = GPIO_PIN_14 ;
455
- break ;
456
- case LL_GPIO_PIN_15 :
457
- SD_detect_gpio_pin = GPIO_PIN_15 ;
458
- break ;
459
- default :
460
- Error_Handler ();
461
- break ;
462
- }
463
- stm32_interrupt_enable (SD_detect_gpio_port , SD_detect_gpio_pin , callback , GPIO_MODE_IT_RISING_FALLING );
464
- sd_state = MSD_OK ;
465
- }
466
- return sd_state ;
467
- }
468
-
469
401
/**
470
402
* @brief Detects if SD card is correctly plugged in the memory slot or not.
471
403
* @retval Returns if SD is detected or not
0 commit comments