Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADCHS Filter Interrupt handler called twice #73

Open
picerno76 opened this issue Jul 1, 2024 · 0 comments
Open

ADCHS Filter Interrupt handler called twice #73

picerno76 opened this issue Jul 1, 2024 · 0 comments

Comments

@picerno76
Copy link

it is called twice because the flag is cleared before the reading of the data in the user callback

void __attribute__((used)) ADC_DF1_InterruptHandler(void)
{
    IFS1CLR = _IFS1_ADCDF1IF_MASK;
    if (ADCHS_DFCallbackObj[0].callback_fn != NULL)
    {
      ADCHS_DFCallbackObj[0].callback_fn(ADCHS_DFCallbackObj[0].context);
    }
}

I have fixed it clearing the flag again in the callback after the reading but I think that the library should be fixed this way

void __attribute__((used)) ADC_DF1_InterruptHandler(void)
{
    if (ADCHS_DFCallbackObj[0].callback_fn != NULL)
    {
      ADCHS_DFCallbackObj[0].callback_fn(ADCHS_DFCallbackObj[0].context);
    }
    IFS1CLR = _IFS1_ADCDF1IF_MASK;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant