2018-06-28 04:19 AM
I am trying to use BSP SD functions. One way to detect if SD card is inserted is with BSP_SD_IsDetected()
and another way is via interrupts w/ BSP_SD_ITConfig() .
The comments don't explicitly say which is the correct IRQ handler to use, but I'm pretty sure it is this macro I need:
&sharpdefine
SD_DetectIRQHandler
()
HAL_GPIO_EXTI_IRQHandler
(SD_DETECT_PIN)
Trying to use it in my project, it gives me following errors:
/home/..../Inc/stm32f7xx_hal_gpio.h:115:36: error: expected declaration specifiers or '...' before '(' token&sharpdefine GPIO_PIN_13 ((uint16_t)0x2000U) /* Pin 13 selected */^/home/jure/Projects/ARMdev_stuff/STM32Cube_FW_F7_V1.11.0/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery.h:168:46: note: in expansion of macro 'GPIO_PIN_13'&sharpdefine SD_DETECT_PIN GPIO_PIN_13^~~~~~~~~~~/home/jure/Projects/ARMdev_stuff/STM32Cube_FW_F7_V1.11.0/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_sd.h:104:68: note: in expansion of macro 'SD_DETECT_PIN'&sharpdefine SD_DetectIRQHandler() HAL_GPIO_EXTI_IRQHandler(SD_DETECT_PIN)^~~~~~~~~~~~~src/interrupts.c:15:6: note: in expansion of macro 'SD_DetectIRQHandler'void SD_DetectIRQHandler()^~~~~~~~~~~~~~~~~~~Also this ''error-type'' shows up in my IDE, I don't know what it means though:
How can I detect SD Card presence with interrupts? What function should I implement as a IRQHandler for this event?
#sd #f7 #stm32f746-discovery #sd-card #bsp2018-06-28 04:40 AM
Why would you do this?
void SD_DetectIRQHandler()
Surely you'd just want to expand the macro not create a body function
Wouldn't this be the expected utilization?
void EXTI15_10_IRQHandler(void)
{
SD_DetectIRQHandler();
}
2018-06-28 07:45 AM
Aah yes, your version makes much more sense!
:)
I tought it's a bit wrong what I was doing.Still, my approach of implementing a function wasn't totally crazy - since I want to detect the ''SD-inserted event'' and do something (execude my code) when that happens. What is the point of having this BSP macro/function if you can't control what it does + still have to figure out by yourself what is the handler name (EXTI15_10_IRQHandler)?
Anyway, thanks for clearing up how this macro works!
2018-06-28 09:20 AM
With the HAL model you'd put your functionality in a callback from the EXTI, this is just plumbing to get to that.
If it is simpler you can add code to the IRQ Handler to qualify the source and do your thing in there.
2018-06-28 12:00 PM
I believe I'll do it this way, yes. Thanks for answering!