esp-idf/components/esp_adc/curve_fitting_coefficients.h
laokaiyao edc1abc8ea refactor(adc_calib): Simplify 2nd step coefficient calculation
- remove unnecessary variables and calculations
- improve readability of code
2023-07-06 14:22:03 +08:00

32 lines
922 B
C

/*
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include "esp_adc/adc_cali_scheme.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint8_t term_num; ///< Term number of the algorithm formula
const uint64_t (*coeff)[2]; ///< Coeff of each term. See `adc_error_coef_atten` for details (and the magic number 2)
const int32_t (*sign); ///< Sign of each term
} cali_chars_second_step_t;
/**
* @brief Assign the second step coefficients for curve calibration
*
* @param config the curve fitting configuration
* @param ctx the context pointer of the second step configuration structure
*/
void curve_fitting_get_second_step_coeff(const adc_cali_curve_fitting_config_t *config, cali_chars_second_step_t *ctx);
#ifdef __cplusplus
}
#endif