Touch: Default and active calibration API of sorts.

This commit is contained in:
Jared Boone 2016-07-27 14:03:06 -07:00
parent c022a72ef4
commit 5e5417b456
2 changed files with 24 additions and 0 deletions

View File

@ -74,6 +74,26 @@ ui::Point Calibration::translate(const DigitizerPoint& p) const {
}; };
} }
static const Calibration _default_calibration {
/* Values derived from one PortaPack H1 unit. */
{ { { 256, 731 }, { 880, 432 }, { 568, 146 } } },
{ { { 32, 48 }, { 208, 168 }, { 120, 288 } } }
};
static Calibration _calibration = _default_calibration;
void set_calibration(const Calibration& value) {
_calibration = value;
}
const Calibration& calibration() {
return _calibration;
}
const Calibration& default_calibration() {
return _default_calibration;
}
void Manager::feed(const Frame& frame) { void Manager::feed(const Frame& frame) {
// touch_debounce.feed(touch_raw); // touch_debounce.feed(touch_raw);
const auto touch_raw = frame.touch; const auto touch_raw = frame.touch;

View File

@ -149,6 +149,10 @@ private:
int32_t f; int32_t f;
}; };
void set_calibration(const Calibration& calibration);
const Calibration& calibration();
const Calibration& default_calibration();
template<size_t N> template<size_t N>
class Filter { class Filter {
public: public: