26 lines
458 B
C
26 lines
458 B
C
|
|
#ifndef __CALC_H__
|
||
|
|
#define __CALC_H__
|
||
|
|
|
||
|
|
#define NUM_TYPE float
|
||
|
|
#define CALC_POINTS (128)
|
||
|
|
|
||
|
|
/* y = a * x^2 + b * x + c */
|
||
|
|
struct quadratic_coefficient_s {
|
||
|
|
NUM_TYPE a;
|
||
|
|
NUM_TYPE b;
|
||
|
|
NUM_TYPE c;
|
||
|
|
};
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C" {
|
||
|
|
#endif
|
||
|
|
|
||
|
|
void calc_quadratic_fit_init(int length);
|
||
|
|
void calc_quadratic_fit(NUM_TYPE *buff, struct quadratic_coefficient_s *coeff, int length);
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif /* __CALC_H__ */
|