Files
OpenCellular/chip_interface/lid.h
Louis Yung-Chieh Lo 91daca6939 Add ec_keyboard_test.c
This CL also includes 4 pieces:
  1. main files: environment-independent (main.c) and
                            -dependent (ec_keyboard_test.c).
  2. stub files: chip_stub/keyboard.c simulates the real hardware.
                 chip_stub/keyboard.h is the header of testing functions.
  3. initial keyboard lib code: ec_keyboard.h
  4. rename Cr* function name to Ec* under chip_interface/.

BUG=None
TEST=make && make runtests
Expect seeing the output debug message from cros_ec/lib/ec_keyboard.c.

Change-Id: Ia7e8022060eb0a5d0a11abcbdb3f524942f5c68d
2011-10-26 22:12:19 +08:00

42 lines
1.0 KiB
C

/* Copyright (c) 2011 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.
*
* lid.h - handle lid open/close
*/
#ifndef __CHIP_INTERFACE_LID_H
#define __CHIP_INTERFACE_LID_H
/* Initialize the GPIO pin */
EcError EcLidSwitchInit(void);
/* Calls GPIOPinRead() to read the GPIO state. */
/* TODO: has the state been debounced? */
EcError EcLidSwitchState(void);
/* Register a calback function. It is called while lid state is changed.
*/
EcError EcLidSwitchRegister(void (*callback)(void));
/* Below is the example code to register this function. */
#if 0
/* This callback function is implemented in Chrome OS features layer. */
void LidSwitchChanged(void) {
int lid_open = EcLidSwitchState();
if (lid_open) {
if (system is in S3) {
// resume system
}
} else {
if (system is in S0) {
// suspend system
}
}
}
... somewhere in init code ...
EcLidSwitchRegister(LidSwitchChanged);
#endif
#endif /* __CHIP_INTERFACE_LID_H */