static (no heap) linear interpolation for personal usage
- #define the number of points of your dataset #define N_POINTS 64
- create 2 float arrays x[N_POINTS], y[N_POINTS] filled with your dataset
- create 1 float array for cache: cache[(N_POINTS-1)*2]
- create 1 bool (uint8_t) array for cache: bcache[N_POINTS-1]
- create interp_t variable: interp_t interp;
- initialize interp_t interp with interp_init(...): interp_init(interp, x, y, cache, bcache, n_points)
- calculate wanted y(x) with interp_calc(interp_t *obj, float x, float *y_calc): interp_calc(interp, x, &y_calc); // calculated value will be stored in y_calc
- ???
- feel free to rewrite the code if needed