cancel
Showing results for 
Search instead for 
Did you mean: 

UM2319 Documentation Error UM2319 Rev 2 page 95/2202

KiptonM
Lead

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.

2 REPLIES 2
Aime
ST Employee

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

KiptonM
Lead

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"