Skip to main content
Explorer
June 8, 2022
Question

UM2319 Documentation Error UM2319 Rev 2 page 95/2202

  • June 8, 2022
  • 2 replies
  • 744 views

I decided to try to use the __HAL_ADC_ENABLE_IT() macro. UM2319 page 95/2202 Rev 2

It says the first argument is the ADC handle.

ADC_HandleTypeDef hadc1; is the handle.

This macro wants the ADC handle pointer which is &hadc1 not hadc1.

Looks like the other macros in this section may have the same documentation issue.

    This topic has been closed for replies.

    2 replies

    ST Employee
    June 9, 2022

    Hi @KiptonM​ ,

    Thank you for reporting this.

    But I do not think this is an issue because the ADC Handle is a parameter of type #Struct of #Struct.

    And looking at this macro description, only the #Struct Instance of the ADC Handle is used.

    #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__)             \

     (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__))

    With all that to use this macro, you need to pass the pointer of ADC Handle otherwise you will have a compiling C error.

    Best Regards,

    A.MVE

    KiptonMAuthor
    Explorer
    June 10, 2022

    Exactly. You need the pointer. to the handle, not the handle. That is what the issue is.

    The handle is hadc1. It is a structure. You can directly use it with hadc1.***

    The pointer to the handle is &hadc1. (& means take the address of the item, a.k.a. a pointer.)

    This you have to use as hadc1->*** there is a difference.

    You need to use the pointer to the handle (&hadc1). The handle (hadc1) will not work.

    What would you have called it if you needed to use hadc1 (not &hadc1) and the macro was written

    #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__)             \

     (((__HANDLE__).Instance->IER) |= (__INTERRUPT__))

    You would have said use the "handle"