diff options
Diffstat (limited to 'board/discovery')
-rw-r--r-- | board/discovery/board.c | 36 | ||||
-rw-r--r-- | board/discovery/board.h | 30 |
2 files changed, 48 insertions, 18 deletions
diff --git a/board/discovery/board.c b/board/discovery/board.c index 5a8f601cec..6786716476 100644 --- a/board/discovery/board.c +++ b/board/discovery/board.c @@ -9,22 +9,38 @@ #include "registers.h" #include "util.h" +#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) +#define GPIO_KB_OUTPUT (GPIO_OUTPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) + /* 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}, - {"KB_COL00", GPIO_C, (1<<8), GPIO_INT_BOTH, matrix_interrupt}, - {"KB_COL01", GPIO_C, (1<<9), GPIO_INT_BOTH, matrix_interrupt}, - {"KB_COL02", GPIO_C, (1<<10), GPIO_INT_BOTH, matrix_interrupt}, - {"KB_COL03", GPIO_C, (1<<11), GPIO_INT_BOTH, matrix_interrupt}, - {"KB_COL04", GPIO_C, (1<<12), GPIO_INT_BOTH, matrix_interrupt}, - {"KB_COL05", GPIO_C, (1<<14), GPIO_INT_BOTH, matrix_interrupt}, - {"KB_COL06", GPIO_C, (1<<15), GPIO_INT_BOTH, matrix_interrupt}, - {"KB_COL07", GPIO_D, (1<<2), GPIO_INT_BOTH, matrix_interrupt}, + {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT, matrix_interrupt}, + {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT, matrix_interrupt}, + {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT, matrix_interrupt}, + {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT, matrix_interrupt}, + {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT, matrix_interrupt}, + {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT, matrix_interrupt}, + {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, matrix_interrupt}, + {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, matrix_interrupt}, /* Other inputs */ /* Outputs */ - {"BLUE_LED", GPIO_B, (1<<6), GPIO_OUT_LOW, NULL}, - {"GREEN_LED", GPIO_B, (1<<7), GPIO_OUT_LOW, NULL}, + {"BLUE_LED", GPIO_B, (1<<6), GPIO_OUT_LOW, NULL}, + {"GREEN_LED", GPIO_B, (1<<7), GPIO_OUT_LOW, NULL}, + {"KB_OUT00", GPIO_B, (1<<5), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT09", GPIO_A, (1<<1), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT10", GPIO_A, (1<<2), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT11", GPIO_C, (1<<6), GPIO_KB_OUTPUT, NULL}, + {"KB_OUT12", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL}, }; void configure_board(void) diff --git a/board/discovery/board.h b/board/discovery/board.h index 12eeaf5246..5b63e80abc 100644 --- a/board/discovery/board.h +++ b/board/discovery/board.h @@ -24,18 +24,32 @@ enum gpio_signal { /* Inputs with interrupt handlers are first for efficiency */ GPIO_USER_BUTTON = 0, /* Blue user button */ /* Keyboard inputs */ - KB_COL00, - KB_COL01, - KB_COL02, - KB_COL03, - KB_COL04, - KB_COL05, - KB_COL06, - KB_COL07, + GPIO_KB_IN00, + GPIO_KB_IN01, + GPIO_KB_IN02, + GPIO_KB_IN03, + GPIO_KB_IN04, + GPIO_KB_IN05, + GPIO_KB_IN06, + GPIO_KB_IN07, /* Other inputs */ /* Outputs */ GPIO_BLUE_LED, /* Blue debug LED */ GPIO_GREEN_LED, /* Green debug LED */ + /* Keyboard outputs */ + GPIO_KB_OUT00, + GPIO_KB_OUT01, + GPIO_KB_OUT02, + GPIO_KB_OUT03, + GPIO_KB_OUT04, + GPIO_KB_OUT05, + GPIO_KB_OUT06, + GPIO_KB_OUT07, + GPIO_KB_OUT08, + GPIO_KB_OUT09, + GPIO_KB_OUT10, + GPIO_KB_OUT11, + GPIO_KB_OUT12, /* Number of GPIOs; not an actual GPIO */ GPIO_COUNT |