cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible for MX to set USE_HAL_ADC_REGISTER_CALLBACKS?

RBack.1
Senior

I need to use the ADC ISR to set a FreeRTOS semaphore. It seems that hadc1.ConvCpltCallback is the perfect feature to do this except it's not enabled unless USE_HAL_ADC_REGISTER_CALLBACKS is set. For the life of me I can't figure out how to make MX set this flag. Is it possible?

1 ACCEPTED SOLUTION

Accepted Solutions
Paul1
Lead

0693W00000Lyqf5QAB.pngHere's an excerpt for some callback setups in MX from some of our internal project documentation.

1)     USE_HAL_TIM_REGISTER_CALLBACKS

set the register callback manually in CubeMx via

Project Manager -> Advanced Settings -> Register Callbacks (far right-hand side).

There you can enable/disable register callbacks for each peripheral individually.

ref: https://community.st.com/s/question/0D50X0000ArRvt6/stmcubeide-usehalregistercallbacks-definition

View solution in original post

5 REPLIES 5
Pavel A.
Evangelist III

You can also use the global callbacks. Please read the ADC driver source to find names of these global callbacks (they are defined as empty "weak" functions in the HAL driver and you override them by providing your own). Or browse examples in the Cube package.

RBack.1
Senior

Thanks, that is a workaround. I could also place custom code in the USER CODE BEGIN ADC_IRQn sections. It is pretty annoying to go through the trouble of keeping my project up-to-date with MX, however, just to find something at the end that isn't supported by the tool.

Paul1
Lead

0693W00000Lyqf5QAB.pngHere's an excerpt for some callback setups in MX from some of our internal project documentation.

1)     USE_HAL_TIM_REGISTER_CALLBACKS

set the register callback manually in CubeMx via

Project Manager -> Advanced Settings -> Register Callbacks (far right-hand side).

There you can enable/disable register callbacks for each peripheral individually.

ref: https://community.st.com/s/question/0D50X0000ArRvt6/stmcubeide-usehalregistercallbacks-definition

You shouldn't compress screenshots to the lossy JPEG, but always use the lossless PNG. Not only PNG will not damage the picture, but will typically be even smaller than JPEG.

Thank you for pointing me to this!