aboutsummaryrefslogtreecommitdiff
path: root/sys/dist.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dist.h')
-rw-r--r--sys/dist.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/dist.h b/sys/dist.h
new file mode 100644
index 0000000..a1fc13e
--- /dev/null
+++ b/sys/dist.h
@@ -0,0 +1,20 @@
+#ifndef DIST_H
+#define DIST_H
+
+#include "gpio.h"
+#include "irq.h"
+
+struct dist_sensor {
+ pinspec trig_pin;
+ pinspec echo_pin;
+ irq_t echo_irq;
+
+ uint16_t distance;
+
+ uint64_t delta_time;
+};
+
+void dist_init(struct dist_sensor* sensor);
+void dist_read(struct dist_sensor* sensor);
+
+#endif