mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
Provide the required plumbing for the stm32 keyboard scan code so that the message layer will pick up keyboard scans. The design is as follows: - When a change in keyboard state is detected, the keyboard matrix scanning code will call the board-specific board_keyboard_scan_ready() function to interrupt the AP. - The AP will initiate a CMDC_KEY_STATE transaction over SPI or I2C - The SPI or I2C driver will call message_process_cmd() to process the command - This in turn will call keyboard_get_scan() to get the latest scan data For SPI: - The AP will initiate an 20-byte (or longer) SPI transaction - The EC will see the command, and provide the keyboard state in response, with the response being part of the same transaction For I2C: - The AP will initiate a 1-byte write to set the EC mode. - The AP will then initiate an 18-byte read, and the EC will send the message including keyboard state BUG=chromium-os:28925 TEST=build on daisy and discovery; run on daisy Change-Id: I905ef9d567e43d85fb851052f67586eff58e1167 Signed-off-by: Simon Glass <sjg@chromium.org>
35 lines
1.0 KiB
C
35 lines
1.0 KiB
C
/* Copyright (c) 2012 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.
|
|
*/
|
|
|
|
/* Keyboard scanner module for Chrome EC */
|
|
|
|
#ifndef __CROS_EC_KEYBOARD_SCAN_H
|
|
#define __CROS_EC_KEYBOARD_SCAN_H
|
|
|
|
#include "common.h"
|
|
|
|
/* Initializes the module. */
|
|
int keyboard_scan_init(void);
|
|
|
|
/* Returns non-zero if recovery key was pressed at boot. */
|
|
int keyboard_scan_recovery_pressed(void);
|
|
|
|
/**
|
|
* Get the scan data from the keyboard.
|
|
*
|
|
* This returns the results of the last keyboard scan, by pointing the
|
|
* supplied buffer to it, and returning the number of bytes available.
|
|
*
|
|
* The supplied buffer can be used directly if required, but in that case
|
|
* the number of bytes available is limited to 'max_bytes'.
|
|
*
|
|
* @param buffp Pointer to buffer to contain data
|
|
* @param max_bytes Maximum number of bytes available in *buffp
|
|
* @return number of bytes available, or -1 for error
|
|
*/
|
|
int keyboard_get_scan(uint8_t **buffp, int max_bytes);
|
|
|
|
#endif /* __CROS_KEYBOARD_SCAN_H */
|