summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-10-17 18:54:25 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-10-17 18:54:25 +0200
commit399c5385d5c449cc3cde314e7a4e42f7a242a4cb (patch)
treeb950081831a6db6c05f2b5accb4db785e4c0b0d2 /include
parent9fd36d9cc10fbefa578bf8b1b2c308bf775af4f9 (diff)
Add DS2482-100 Single-Channel 1-Wire Master driver
Diffstat (limited to 'include')
-rw-r--r--include/driver/ds2482.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/driver/ds2482.h b/include/driver/ds2482.h
new file mode 100644
index 0000000..cb0b577
--- /dev/null
+++ b/include/driver/ds2482.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2021 Daniel Friesel
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * DS2482-100 Single-Channel 1-Wire Master
+ */
+#pragma once
+
+class DS2482 {
+ private:
+ DS2482(const DS2482 &copy);
+ unsigned char const address;
+ unsigned char txbuf[2];
+ unsigned char rxbuf[1];
+
+ public:
+ DS2482(unsigned char const addr) : address(addr) {}
+
+ void setup();
+ void busReset();
+ unsigned char status();
+ void readROM(unsigned char *data, unsigned char len);
+};
+
+extern DS2482 ds2482;