summaryrefslogtreecommitdiffstats
path: root/quantum/digitizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/digitizer.h')
-rw-r--r--quantum/digitizer.h67
1 files changed, 56 insertions, 11 deletions
diff --git a/quantum/digitizer.h b/quantum/digitizer.h
index cef551567e..b826ba8ac8 100644
--- a/quantum/digitizer.h
+++ b/quantum/digitizer.h
@@ -17,25 +17,70 @@
#include "quantum.h"
+#include <stdbool.h>
#include <stdint.h>
-enum digitizer_status { DZ_INITIALIZED = 1, DZ_UPDATED = 2 };
+/**
+ * \defgroup digitizer
+ *
+ * HID Digitizer
+ * \{
+ */
typedef struct {
- int8_t tipswitch;
- int8_t inrange;
- uint8_t id;
- float x;
- float y;
- uint8_t status : 2;
+ bool in_range : 1;
+ bool tip : 1;
+ bool barrel : 1;
+ float x;
+ float y;
+ bool dirty;
} digitizer_t;
-extern digitizer_t digitizer;
+extern digitizer_t digitizer_state;
-digitizer_t digitizer_get_report(void);
+/**
+ * \brief Send the digitizer report to the host if it is marked as dirty.
+ */
+void digitizer_flush(void);
-void digitizer_set_report(digitizer_t newDigitizerReport);
+/**
+ * \brief Assert the "in range" indicator, and flush the report.
+ */
+void digitizer_in_range_on(void);
-void digitizer_task(void);
+/**
+ * \brief Deassert the "in range" indicator, and flush the report.
+ */
+void digitizer_in_range_off(void);
+
+/**
+ * \brief Assert the tip switch, and flush the report.
+ */
+void digitizer_tip_switch_on(void);
+
+/**
+ * \brief Deassert the tip switch, and flush the report.
+ */
+void digitizer_tip_switch_off(void);
+
+/**
+ * \brief Assert the barrel switch, and flush the report.
+ */
+void digitizer_barrel_switch_on(void);
+
+/**
+ * \brief Deassert the barrel switch, and flush the report.
+ */
+void digitizer_barrel_switch_off(void);
+
+/**
+ * \brief Set the absolute X and Y position of the digitizer contact, and flush the report.
+ *
+ * \param x The X value of the contact position, from 0 to 1.
+ * \param y The Y value of the contact position, from 0 to 1.
+ */
+void digitizer_set_position(float x, float y);
void host_digitizer_send(digitizer_t *digitizer);
+
+/** \} */