summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/s5851a.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/driver/s5851a.cc b/src/driver/s5851a.cc
new file mode 100644
index 0000000..be46181
--- /dev/null
+++ b/src/driver/s5851a.cc
@@ -0,0 +1,18 @@
+#include "driver/s5851a.h"
+#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(DRIVER_SOFTI2C)
+#include "driver/i2c.h"
+#else
+#include "driver/soft_i2c.h"
+#endif
+
+float S5851A::getTemp()
+{
+ txbuf[0] = 0;
+ rxbuf[0] = 0;
+ rxbuf[1] = 0;
+ i2c.xmit(address, 1, txbuf, 2, rxbuf);
+
+ return rxbuf[0] + (rxbuf[1] / 256.0);
+}
+
+S5851A s5851a(0x4b);