diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2016-04-11 15:24:38 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-04-20 21:56:06 -0700 |
commit | 671621b4c404f277173780d9ce3346204ab58fec (patch) | |
tree | 5566a37a4b1bab53414aa328f33ba6cfe92d51a2 /board/nucleo-f072rb/board.c | |
parent | ba27af23156f77ab30790ba095ae6696dc3ee572 (diff) | |
download | chrome-ec-671621b4c404f277173780d9ce3346204ab58fec.tar.gz |
nucleo-f072rb: Add initial set of board files
This change adds files to support nucleo-f072rb. This board can be used as
a DUT to test STM32F072.
BUG=none
BRANCH=tot
TEST=Verified EC console works. Flashed the board by 'make flash'. User LED
brinks periodically and when user button is pressed.
make buildall && make tests
Change-Id: I628f229b62c4b06d19d8245121f79a13e17bc2e9
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/338461
Diffstat (limited to 'board/nucleo-f072rb/board.c')
-rw-r--r-- | board/nucleo-f072rb/board.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/board/nucleo-f072rb/board.c b/board/nucleo-f072rb/board.c new file mode 100644 index 0000000000..7bbfdfab39 --- /dev/null +++ b/board/nucleo-f072rb/board.c @@ -0,0 +1,37 @@ +/* Copyright 2016 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. + */ + +#include "common.h" +#include "gpio.h" +#include "hooks.h" +#include "registers.h" +#include "task.h" + +void button_event(enum gpio_signal signal) +{ + gpio_set_level(GPIO_LED_U, 1); +} + +#include "gpio_list.h" + +void tick_event(void) +{ + static int count; + + gpio_set_level(GPIO_LED_U, (count & 0x07) == 0); + + count++; +} +DECLARE_HOOK(HOOK_TICK, tick_event, HOOK_PRIO_DEFAULT); + +/****************************************************************************** + * Initialize board. + */ +static void board_init(void) +{ + gpio_enable_interrupt(GPIO_USER_BUTTON); + +} +DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); |