mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 01:21:49 +00:00
Merge "daisy/snow: define KB_OUTPUTS in board.h, remove KB_COLS"
This commit is contained in:
@@ -22,6 +22,9 @@
|
||||
|
||||
#define USB_CHARGE_PORT_COUNT 0
|
||||
|
||||
/* EC drives 13 outputs to keyboard matrix */
|
||||
#define KB_OUTPUTS 13
|
||||
|
||||
/* GPIO signal list */
|
||||
enum gpio_signal {
|
||||
/* Inputs with interrupt handlers are first for efficiency */
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
#define USB_CHARGE_PORT_COUNT 0
|
||||
|
||||
/* EC drives 13 outputs to keyboard matrix */
|
||||
#define KB_OUTPUTS 13
|
||||
|
||||
/* GPIO signal list */
|
||||
enum gpio_signal {
|
||||
/* Inputs with interrupt handlers are first for efficiency */
|
||||
|
||||
@@ -33,16 +33,14 @@ enum COL_INDEX {
|
||||
#define POLLING_MODE_TIMEOUT 100000 /* 100 ms */
|
||||
#define SCAN_LOOP_DELAY 10000 /* 10 ms */
|
||||
|
||||
#define KB_COLS 13
|
||||
|
||||
/* 15:14, 12:8, 2 */
|
||||
#define IRQ_MASK 0xdf04
|
||||
|
||||
/* The keyboard state from the last read */
|
||||
static uint8_t raw_state[KB_COLS];
|
||||
static uint8_t raw_state[KB_OUTPUTS];
|
||||
|
||||
/* The keyboard state we will return when requested */
|
||||
static uint8_t saved_state[KB_COLS];
|
||||
static uint8_t saved_state[KB_OUTPUTS];
|
||||
|
||||
/* Mask with 1 bits only for keys that actually exist */
|
||||
static const uint8_t *actual_key_mask;
|
||||
@@ -50,7 +48,7 @@ static const uint8_t *actual_key_mask;
|
||||
/* All actual key masks (todo: move to keyboard matrix definition) */
|
||||
/* TODO: (crosbug.com/p/7485) fill in real key mask with 0-bits for coords that
|
||||
aren't keys */
|
||||
static const uint8_t actual_key_masks[4][KB_COLS] = {
|
||||
static const uint8_t actual_key_masks[4][KB_OUTPUTS] = {
|
||||
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
|
||||
{0},
|
||||
@@ -169,7 +167,7 @@ static int check_keys_changed(void)
|
||||
int change = 0;
|
||||
int num_press = 0;
|
||||
|
||||
for (c = 0; c < KB_COLS; c++) {
|
||||
for (c = 0; c < KB_OUTPUTS; c++) {
|
||||
uint16_t tmp;
|
||||
|
||||
/* Select column, then wait a bit for it to settle */
|
||||
@@ -221,7 +219,7 @@ static int check_keys_changed(void)
|
||||
select_column(COL_TRI_STATE_ALL);
|
||||
|
||||
/* Count number of key pressed */
|
||||
for (c = 0; c < KB_COLS; c++) {
|
||||
for (c = 0; c < KB_OUTPUTS; c++) {
|
||||
if (raw_state[c])
|
||||
++num_press;
|
||||
}
|
||||
@@ -231,7 +229,7 @@ static int check_keys_changed(void)
|
||||
board_keyboard_scan_ready();
|
||||
|
||||
CPRINTF("[%d keys pressed: ", num_press);
|
||||
for (c = 0; c < KB_COLS; c++) {
|
||||
for (c = 0; c < KB_OUTPUTS; c++) {
|
||||
if (raw_state[c])
|
||||
CPRINTF(" %02x", raw_state[c]);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user