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

ADC: improve calibration by using a polynomial #74

Open
jnaulet opened this issue Dec 2, 2023 · 1 comment
Open

ADC: improve calibration by using a polynomial #74

jnaulet opened this issue Dec 2, 2023 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jnaulet
Copy link
Owner

jnaulet commented Dec 2, 2023

Calibration can be improved by using some kind of polynomial.
As not all architectures support floating point, it might take the form of a series of fractions, like:

struct adc_polynomial {
    unsigned long numerator;
    unsigned long denominator;
};

While calibrating the ADC, it might look like:

    static struct adc_polynomial poly[3] = {
        { 64, 73 }, { 2442, 10000 }, { 32, 37 }
    };

    (void)adc_set_polynomial(&ADCx, poly, (size_t)3);
@jnaulet jnaulet added enhancement New feature or request good first issue Good for newcomers labels Dec 2, 2023
@jnaulet
Copy link
Owner Author

jnaulet commented Jul 3, 2024

This might be a upper layer, and make adc_read return uint16_t, for example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant