#ifndef __RESI_MATH_LIB_H__
#define __RESI_MATH_LIB_H__
#include "main.h"
#include "stdint.h"
#include "string.h"


typedef struct {
    uint16_t *sensor_adc_value;
    uint16_t *resi_adc_value;
    uint16_t math_number;
} math_resi_cal_t;

typedef enum {
    SCAN_HIGH_LEVEL,
    SCAN_LOW_LEVEL
} SCAN_LEVEL_T;

typedef enum {
    RESI_BACKWARDS,
    RESI_SCALE
} MATH_RESI_DISPLAY_TYPE_T;

typedef enum {
    SINGLE_BYTE,
    DOUBLE_BYTE,
} DATA_BIT_SIZE_T;

void math_resi_cali_once(math_resi_cal_t *math_resi_cal,
        uint16_t *math_resi_buffer,
        uint16_t math_resi_buffer_size,
        SCAN_LEVEL_T scan_level);

void math_display_resi(uint16_t *math_resi_buffer,
        void *display_buffer,
        uint16_t buffer_size,
        MATH_RESI_DISPLAY_TYPE_T type,
				DATA_BIT_SIZE_T data_bit_size);

void math_resi_init(uint16_t max_display_resi_cal,
        uint16_t min_display_resi_cal,
        uint16_t resi_ref_value,
        uint16_t adc_max_value,
        uint16_t max_display);


void math_resi_init_single(uint16_t *max_display_resi_cal_single, 
													 uint16_t *min_display_resi_cal_single, 
													 uint16_t resi_ref_value, 
													 uint16_t adc_max_value, 
													 uint16_t max_display_value, 
													 uint16_t array_len);

void math_display_resi_single(uint16_t *math_resi_buffer,
        void *display_buffer,
        uint16_t buffer_size,
        MATH_RESI_DISPLAY_TYPE_T type,
				DATA_BIT_SIZE_T data_bit_size);

#endif
