summaryrefslogtreecommitdiff
path: root/NxWidgets/nxwm/include/ccalibration.hxx
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-10-14 18:35:23 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-10-14 18:35:23 -0600
commitb5a37a3e45ac9faea285cc252e742c1c7267a6d7 (patch)
tree678ad7a3d43ff4bdbc9a5ba2bc280ad9dcfea2b6 /NxWidgets/nxwm/include/ccalibration.hxx
parentc4bd33095126562d1f54c63187288d98bf2c4eec (diff)
downloadnuttx-b5a37a3e45ac9faea285cc252e742c1c7267a6d7.tar.gz
nuttx-b5a37a3e45ac9faea285cc252e742c1c7267a6d7.tar.bz2
nuttx-b5a37a3e45ac9faea285cc252e742c1c7267a6d7.zip
NxWM::CCalibration: Add logic to collect and average samples, optionally discarding the most extreem values
Diffstat (limited to 'NxWidgets/nxwm/include/ccalibration.hxx')
-rw-r--r--NxWidgets/nxwm/include/ccalibration.hxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/NxWidgets/nxwm/include/ccalibration.hxx b/NxWidgets/nxwm/include/ccalibration.hxx
index 376462ca8..30a48f7eb 100644
--- a/NxWidgets/nxwm/include/ccalibration.hxx
+++ b/NxWidgets/nxwm/include/ccalibration.hxx
@@ -160,6 +160,10 @@ namespace NxWM
bool m_stop; /**< True: We have been asked to stop the calibration */
bool m_touched; /**< True: The screen is touched */
uint8_t m_touchId; /**< The ID of the touch */
+#if CONFIG_NXWM_CALIBRATION_AVERAGE
+ uint8_t m_nsamples; /**< Number of samples collected so far at this position */
+ struct nxgl_point_s m_sampleData[CONFIG_NXWM_CALIBRATION_NSAMPLES];
+#endif
struct nxgl_point_s m_calibData[CALIB_DATA_POINTS];
/**
@@ -170,6 +174,22 @@ namespace NxWM
void touchscreenInput(struct touch_sample_s &sample);
+#ifdef CONFIG_NXWM_CALIBRATION_MESSAGES
+ /**
+ * Create widgets need by the calibration thread.
+ *
+ * @return True if the widgets were successfully created.
+ */
+
+ bool createWidgets(void);
+
+ /**
+ * Destroy widgets created for the calibration thread.
+ */
+
+ void destroyWidgets(void);
+#endif
+
/**
* Start the calibration thread.
*
@@ -230,6 +250,17 @@ namespace NxWM
static FAR void *calibration(FAR void *arg);
/**
+ * Accumulate and average touch sample data
+ *
+ * @param average. When the averaged data is available, return it here
+ * @return True: Average data is available; False: Need to collect more samples
+ */
+
+#if CONFIG_NXWM_CALIBRATION_AVERAGE
+ bool averageSamples(struct nxgl_point_s &average);
+#endif
+
+ /**
* This is the calibration state machine. It is called initially and then
* as new touchscreen data is received.
*/