commit
189b4231a9
@ -0,0 +1,27 @@
|
||||
#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];
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
#ifndef __OFFSET_H
|
||||
#define __OFFSET_H
|
||||
|
||||
#include "main.h"
|
||||
#include <stdint.h>
|
||||
|
||||
extern int16_t offset_measure[4];
|
||||
extern int16_t offset_count[4];
|
||||
extern int16_t offset_val[4];
|
||||
extern int16_t offsets[4];
|
||||
|
||||
void offset_init();
|
||||
int16_t offset_measure_start(int16_t channel);
|
||||
int16_t offset_measure_stop(int16_t channel);
|
||||
|
||||
#endif
|
||||
Loading…
Reference in new issue