How to compare 2 AdcHandle objects equal or not?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-15 1: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 "==".
- Labels:
-
ADC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-15 2:07 AM
Use memcmp for this two structures.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-15 2: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-15 2:15 AM
if (ADC_Handler == &ADC_Handler_1)
{
...
}
What about this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-17 8: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.
