#include "offset.h" int16_t offset_measure[4]; int16_t offset_count[4]; int16_t offset_val[4]; int16_t offsets[4]; void offset_init() { offsets[0] = 2342; offsets[1] = 4223; offsets[2] = 2423; offsets[3] = 4232; } int16_t offset_measure_start(int16_t channel) { offset_measure[channel] = 1; offset_count[channel] = 1; offset_val[channel] = 0; return 1; } int16_t offset_measure_stop(int16_t channel) { offset_measure[channel] = 0; offsets[channel] = offset_val[channel] / offset_count[channel]; return offsets[channel]; }