2023-03-15 01:50 AM
I have 2 ADC_HandlerTypeDef objects came from 2 different channel of ADC1, and I have an ADC function, like this:
ADC_read(ADC_HandlerTypeDef ADC_Handler)
How can I use this function for 2 channels?
I tried this:
if (ADC_Handler == ADC_Handler_1)
{
...
}
if (ADC_Handler == ADC_Handler_2)
{
...
}
there was compile error for "==".
2023-03-15 02:07 AM
Use memcmp for this two structures.
2023-03-15 02:11 AM
This method was too heavy, since the 2 objects were different in "ADC_Channel", I want to know how to get the channel number for the ADC_Handler argument.
2023-03-15 02:15 AM
if (ADC_Handler == &ADC_Handler_1)
{
...
}
What about this ?
2023-03-17 08:44 PM
I found a solution: define 1 handler, define an array with 2 elements, update the 2 elements once ADC, then shift in 2 ADC channels for 2 elements - each one for a channel.