diff options
Diffstat (limited to 'board/discovery')
-rw-r--r-- | board/discovery/board.c | 20 | ||||
-rw-r--r-- | board/discovery/board.h | 8 |
2 files changed, 18 insertions, 10 deletions
diff --git a/board/discovery/board.c b/board/discovery/board.c index 560773d829..e6a360dbbd 100644 --- a/board/discovery/board.c +++ b/board/discovery/board.c @@ -6,7 +6,19 @@ #include "board.h" #include "common.h" +#include "gpio.h" #include "registers.h" +#include "util.h" + +/* GPIO signal list. Must match order from enum gpio_signal. */ +const struct gpio_info gpio_list[GPIO_COUNT] = { + /* Inputs with interrupt handlers are first for efficiency */ + {"USER_BUTTON", GPIO_A, (1<<0), GPIO_INT_BOTH, NULL}, + /* Other inputs */ + /* Outputs */ + {"BLUE_LED", GPIO_B, (1<<6), GPIO_OUT_LOW, NULL}, + {"GREEN_LED", GPIO_B, (1<<7), GPIO_OUT_LOW, NULL}, +}; void configure_board(void) { @@ -20,9 +32,6 @@ void configure_board(void) (0x7 << 12) | (0x7 << 8); STM32L_GPIO_MODER(B) = (STM32L_GPIO_MODER(B) & ~0x00F00000) | 0x00A00000; - - /* Green and blue LEDs : configure port 6 and 7 as output */ - STM32L_GPIO_MODER(B) |= (1 << (7 * 2)) | (1 << (6 * 2)); } /** @@ -37,11 +46,6 @@ int jtag_pre_init(void) return EC_SUCCESS; } -int gpio_pre_init(void) -{ - return EC_SUCCESS; -} - int eeprom_init(void) { return EC_SUCCESS; diff --git a/board/discovery/board.h b/board/discovery/board.h index 42365cacf2..25d681a18b 100644 --- a/board/discovery/board.h +++ b/board/discovery/board.h @@ -18,8 +18,12 @@ /* GPIO signal list */ enum gpio_signal { - GPIO_DUMMY0 = 0, /* Dummy GPIO */ - GPIO_DUMMY1, + /* Inputs with interrupt handlers are first for efficiency */ + GPIO_USER_BUTTON = 0, /* Blue user button */ + /* Other inputs */ + /* Outputs */ + GPIO_BLUE_LED, /* Blue debug LED */ + GPIO_GREEN_LED, /* Green debug LED */ /* Number of GPIOs; not an actual GPIO */ GPIO_COUNT |