summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-25 12:35:49 -0700
committerGerrit <chrome-bot@google.com>2012-10-25 14:12:11 -0700
commitd4bd167c33e205cab8e01b22975984c668d083b1 (patch)
tree162b5735b45a33e8e901e630307a23cf008e672d /include
parente228692eb2b3828ee39adf5a668e71208478226a (diff)
downloadchrome-ec-d4bd167c33e205cab8e01b22975984c668d083b1.tar.gz
Clean up LED and onewire modules
No functional changes. BUG=chrome-os-partner:15579 BRANCH=none TEST=powerled red, then powerled green Change-Id: I595b725c14d94133f7f151d0b92cabe0e0bcf4ca Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36577 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/onewire.h24
-rw-r--r--include/power_led.h42
2 files changed, 52 insertions, 14 deletions
diff --git a/include/onewire.h b/include/onewire.h
index f28abdd9b4..afa3a2f3d1 100644
--- a/include/onewire.h
+++ b/include/onewire.h
@@ -5,25 +5,39 @@
/* 1-wire interface for Chrome EC */
-/* Note that 1-wire communication is VERY latency-sensitive. If these
+/*
+ * 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. */
+ * times in case of failure.
+ */
#ifndef __CROS_EC_ONEWIRE_H
#define __CROS_EC_ONEWIRE_H
#include "common.h"
-/* Reset the 1-wire bus. Returns error if presence detect fails. */
+/**
+ * Reset the 1-wire bus.
+ *
+ * @return EC_SUCCESS, or non-zero if presence detect fails.
+ */
int onewire_reset(void);
-/* Read a byte from the 1-wire bus. Returns the byte. */
+/**
+ * Read a byte from the 1-wire bus.
+ *
+ * @return The byte value read.
+ */
int onewire_read(void);
-/* Write a byte to the 1-wire bus. */
+/**
+ * Write a byte to the 1-wire bus.
+ *
+ * @param data Byte to write
+ */
void onewire_write(int data);
#endif /* __CROS_EC_ONEWIRE_H */
diff --git a/include/power_led.h b/include/power_led.h
index ccee086f70..2fd7322095 100644
--- a/include/power_led.h
+++ b/include/power_led.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* 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.
*/
@@ -10,6 +10,8 @@
#include "common.h"
+/* Interface for LM4-based boards */
+
enum powerled_color {
POWERLED_OFF = 0,
POWERLED_RED,
@@ -18,6 +20,25 @@ enum powerled_color {
POWERLED_COLOR_COUNT /* Number of colors, not a color itself */
};
+#ifdef CONFIG_POWER_LED
+
+/**
+ * Set the power adapter LED
+ *
+ * @param color Color to set LED
+ *
+ * @return EC_SUCCESS, or non-zero if error.
+ */
+int powerled_set(enum powerled_color color);
+
+#else
+
+static inline int powerled_set(enum powerled_color color) { return 0; }
+
+#endif
+
+/* Interface for STM32-based boards */
+
enum powerled_state {
POWERLED_STATE_OFF,
POWERLED_STATE_ON,
@@ -31,16 +52,19 @@ enum powerled_config {
POWERLED_CONFIG_PWM,
};
-#if defined(CONFIG_TASK_POWERLED) || defined(CONFIG_POWER_LED)
-/* Set the power adapter LED to the specified color. */
-int powerled_set(enum powerled_color color);
+#ifdef CONFIG_TASK_POWERLED
-/* Set the power LED according to the specified state. */
+/**
+ * Set the power LED
+ *
+ * @param state Target state
+ */
void powerled_set_state(enum powerled_state state);
-#else /* CONFIG_TASK_POWERLED */
-static inline int powerled_set(enum powerled_color color) { return 0; }
+#else
+
static inline void powerled_set_state(enum powerled_state state) {}
-#endif /* CONFIG_TASK_POWERLED */
-#endif /* __CROS_EC_POWER_LED_H */
+#endif
+
+#endif /* __CROS_EC_POWER_LED_H */