Skip to main content
hof2
Associate II
August 17, 2016
Question

HAL callback's got me curios

  • August 17, 2016
  • 1 reply
  • 559 views
Posted on August 17, 2016 at 09:42

Hi guys,

I am currently working on an library myself, and I like the way st is doing certain things, so I am ''lending'' myself ideas from the HAL. One thing in particular caught my eye, the callback implementation and it's registration. In my opinion the implementation is feasible, but I was wondering about one thing. If we look at the xx_hal_dma.c/h we can see the function ''HAL_DMA_RegisterCallback'' which is nice. We certainly expect to find such a function, because we know that the HAL uses callbacks a lot. Now, if we search for the mentioned function, we can't find any usage of it, instead the callbacks are set like this:

/* Set the UART DMA transfer complete callback */
huart->hdmatx->XferCpltCallback = UART_DMATransmitCplt;

So now my curiosity kicks in, and my question is why doesn't st use the provided registering-function? I need to say, I didn't check earlier versions of the HAL to see if the register-function is new. I would like to know about your opinion on the matter. It could be as simple as the code didn't get updated yet, or maybe you can thing of a technical reason. Best Regards #callback #st #hal
This topic has been closed for replies.

1 reply

Amel NASRI
ST Technical Moderator
August 18, 2016
Posted on August 18, 2016 at 16:46

Hi life_augmented.st,

A different question is asked about HAL_DMA_RegisterCallback in [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Need%20help%20understanding%20HAL_DMA_RegisterCallback%20function&currentviews=37]this discussion, but I provided there examples where it is used.

You can refer to it.

-Mayla-

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.