libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
VoctCalibration.h
Go to the documentation of this file.
1#pragma once
2
3namespace daisy
4{
19{
20 public:
21 VoctCalibration() : scale_(0.f), offset_(0.f), cal_(false) {}
22
24
39 bool Record(float val1V, float val3V)
40 {
41 float delta = val3V - val1V;
42 scale_ = 24.f / delta;
43 offset_ = 12.f - scale_ * val1V;
44 cal_ = true;
45 return cal_;
46 }
47
51 bool GetData(float &scale, float &offset)
52 {
53 scale = scale_;
54 offset = offset_;
55 return cal_;
56 }
57
62 void SetData(float scale, float offset)
63 {
64 scale_ = scale;
65 offset_ = offset;
66 cal_ = true;
67 }
68
70 inline float ProcessInput(const float inval)
71 {
72 return offset_ + (scale_ * inval);
73 }
74
75 private:
76 float scale_, offset_;
77 bool cal_;
78};
79
80} // namespace daisy
Definition leddriver.h:33
Helper class for calibrating an input to 1V/oct response.
Definition VoctCalibration.h:19
bool GetData(float &scale, float &offset)
Definition VoctCalibration.h:51
~VoctCalibration()
Definition VoctCalibration.h:23
VoctCalibration()
Definition VoctCalibration.h:21
void SetData(float scale, float offset)
Definition VoctCalibration.h:62
float ProcessInput(const float inval)
Definition VoctCalibration.h:70
bool Record(float val1V, float val3V)
Definition VoctCalibration.h:39
Hardware defines and helpers for daisy field platform.
Definition index.h:2