Files
OpenCellular/include/keyboard_mkbp.h
Aseda Aboagye 87a071941b mkbp: Add support for buttons and switches.
Currently, the matrix keyboard protocol does not have support for
handling non-matrixed keys.  This commit adds support for buttons which
do not appear in the keyboard matrix as well as switches.

Additionally, the keyboard FIFO is now just a general MKBP events FIFO
which MKBP events are free to use. Now, buttons and switches wil join
the key matrix event.

BUG=chrome-os-partner:54988
BUG=chrome-os-partner:54976
BUG=chromium:626863
BRANCH=None
TEST=Flash kevin, and verify that keyboard is still functional.
TEST=make -j buildall

CQ-DEPEND=CL:358926

Change-Id: If4ada904cbd5d77823a0710d4671484b198c9d91
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/358633
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-07-19 18:33:36 -07:00

53 lines
1.2 KiB
C

/* Copyright (c) 2013 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.
*
* MKBP keyboard protocol
*/
#ifndef __CROS_EC_KEYBOARD_MKBP_H
#define __CROS_EC_KEYBOARD_MKBP_H
#include "common.h"
#include "keyboard_config.h"
/**
* Add keyboard state into FIFO
*
* @return EC_SUCCESS if entry added, EC_ERROR_OVERFLOW if FIFO is full
*/
int keyboard_fifo_add(const uint8_t *buffp);
/**
* Add an element to the common MKBP FIFO.
*
* @param event_type The MKBP event type.
* @param buffp Pointer to the event data to enqueue.
* @return EC_SUCCESS if entry added, EC_ERROR_OVERFLOW if FIFO is full.
*/
int mkbp_fifo_add(uint8_t event_type, const uint8_t *buffp);
/**
* Clear the MKBP common FIFO.
*/
void mkbp_clear_fifo(void);
/**
* Send KEY_BATTERY keystroke.
*/
#ifdef CONFIG_KEYBOARD_PROTOCOL_MKBP
void keyboard_send_battery_key(void);
#else
static inline void keyboard_send_battery_key(void) { }
#endif
/**
* Update the state of the switches.
*
* @param sw The switch that changed.
* @param state The state of the switch.
*/
void mkbp_update_switches(uint32_t sw, int state);
#endif /* __CROS_EC_KEYBOARD_MKBP_H */