summaryrefslogtreecommitdiff
path: root/board/discovery-stm32f072/board.c
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-07-01 09:02:28 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-09 20:30:21 +0000
commitc14b0644e356c8edacdd2a8d0a070fbbc4c23b4c (patch)
treeb2006f1358a2a6b48fd8e2e3a28c9666162e8a3d /board/discovery-stm32f072/board.c
parent0a9545cb9e48822d37073b2059848e66141803ff (diff)
downloadchrome-ec-c14b0644e356c8edacdd2a8d0a070fbbc4c23b4c.tar.gz
discovery-stm32f072: Initial working version
This version of the EC firmware just provides a console and some blinking lights for the stm32f0 discovery board. This is a convenient board to work with for peripheral bringup. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=none TEST=make buildall -j Change-Id: I9ae87235e8a505d58fa7a5c996528c4dd6c3f2ac Reviewed-on: https://chromium-review.googlesource.com/207130 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'board/discovery-stm32f072/board.c')
-rw-r--r--board/discovery-stm32f072/board.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/board/discovery-stm32f072/board.c b/board/discovery-stm32f072/board.c
new file mode 100644
index 0000000000..546b07d8d9
--- /dev/null
+++ b/board/discovery-stm32f072/board.c
@@ -0,0 +1,41 @@
+/* Copyright (c) 2014 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.
+ */
+/* STM32F072-discovery board configuration */
+
+#include "common.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "registers.h"
+#include "task.h"
+#include "util.h"
+
+void button_event(enum gpio_signal signal);
+
+#include "gpio_list.h"
+
+void button_event(enum gpio_signal signal)
+{
+ static int count = 0;
+
+ gpio_set_level(GPIO_LED_U, (count & 0x03) == 0);
+ gpio_set_level(GPIO_LED_R, (count & 0x03) == 1);
+ gpio_set_level(GPIO_LED_D, (count & 0x03) == 2);
+ gpio_set_level(GPIO_LED_L, (count & 0x03) == 3);
+
+ count++;
+}
+
+/* Initialize board. */
+static void board_init(void)
+{
+ gpio_enable_interrupt(GPIO_USER_BUTTON);
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+/* Pins with alternate functions */
+const struct gpio_alt_func gpio_alt_funcs[] = {
+ {GPIO_A, 0xC000, 1, MODULE_UART}, /* USART2: PA14/PA15 */
+};
+const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs);