summaryrefslogtreecommitdiff
path: root/include/onewire.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-03-13 16:31:59 -0700
committerRandall Spangler <rspangler@chromium.org>2012-03-16 11:03:13 -0700
commita9f4794edb0a7db06b34bf344809db4393e679ac (patch)
tree02fbc4d9be296813b7f8ed2fb1993f2df2d4607a /include/onewire.h
parent54f8d7e323ce6e36612732b4d107e6ee846c6fad (diff)
downloadchrome-ec-a9f4794edb0a7db06b34bf344809db4393e679ac.tar.gz
Add support for 1-wire protocol and power adapter LEDs
BUG=chrome-os-partner:7498 TEST=powerled {off, red, yellow, green} Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: I48beaad94d75c0ec30a969ea4b0e35f54e052085
Diffstat (limited to 'include/onewire.h')
-rw-r--r--include/onewire.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/onewire.h b/include/onewire.h
new file mode 100644
index 0000000000..b7120dca90
--- /dev/null
+++ b/include/onewire.h
@@ -0,0 +1,32 @@
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* 1-wire interface for Chrome EC */
+
+/* Note that 1-wire communication is VERY latency-sensitive. If these
+ * functions are run at low priority, communication may be garbled. However,
+ * these functions are also slow enough (~1ms per call) that it's really not
+ * desirable to put them at high priority. So make sure you check the
+ * confirmation code from the slave for any communication, and retry a few
+ * times in case of failure. */
+
+#ifndef __CROS_EC_ONEWIRE_H
+#define __CROS_EC_ONEWIRE_H
+
+#include "common.h"
+
+/* Initialize the module. */
+int onewire_init(void);
+
+/* Reset the 1-wire bus. Returns error if presence detect fails. */
+int onewire_reset(void);
+
+/* Read a byte from the 1-wire bus. Returns the byte. */
+int onewire_read(void);
+
+/* Write a byte to the 1-wire bus. */
+void onewire_write(int data);
+
+#endif /* __CROS_EC_ONEWIRE_H */