1 /*
2  * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 #include <stdint.h>
9 #include "esp_adc/adc_cali_scheme.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #define COEFF_GROUP_NUM    4
16 #define TERM_MAX           5
17 
18 typedef struct {
19     uint8_t  term_num;                                        ///< Term number of the algorithm formula
20     const uint64_t (*coeff)[COEFF_GROUP_NUM][TERM_MAX][2];    ///< Coeff of each term. See `adc_error_coef_atten` for details (and the magic number 2)
21     const int32_t  (*sign)[COEFF_GROUP_NUM][TERM_MAX];        ///< Sign of each term
22 } cali_chars_second_step_t;
23 
24 /**
25  * @brief Assign the second step coefficients for curve calibration
26  *
27  * @param config the curve fitting configuration
28  * @param ctx   the context pointer of the second step configuration structure
29  */
30 void curve_fitting_get_second_step_coeff(const adc_cali_curve_fitting_config_t *config, cali_chars_second_step_t *ctx);
31 
32 #ifdef __cplusplus
33 }
34 #endif
35