source: svn/trunk/newcon3bcm2_21bu/nexus/modules/keypad/7552/include/nexus_keypad.h

Last change on this file was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 7.4 KB
Line 
1/***************************************************************************
2*     (c)2004-2011 Broadcom Corporation
3*
4*  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5*  and may only be used, duplicated, modified or distributed pursuant to the terms and
6*  conditions of a separate, written license agreement executed between you and Broadcom
7*  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8*  no license (express or implied), right to use, or waiver of any kind with respect to the
9*  Software, and Broadcom expressly reserves all rights in and to the Software and all
10*  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11*  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12*  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
13*
14*  Except as expressly set forth in the Authorized License,
15*
16*  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17*  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18*  and to use this information only in connection with your use of Broadcom integrated circuit products.
19*
20*  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21*  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22*  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23*  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24*  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25*  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26*  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27*  USE OR PERFORMANCE OF THE SOFTWARE.
28*
29*  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30*  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31*  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32*  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33*  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34*  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35*  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36*  ANY LIMITED REMEDY.
37*
38* $brcm_Workfile: nexus_keypad.h $
39* $brcm_Revision: 8 $
40* $brcm_Date: 2/16/11 1:04p $
41*
42* API Description:
43*   API name: Keypad
44*    Specific APIs related to Keypad Input Control.
45*
46* Revision History:
47*
48* $brcm_Log: /nexus/modules/keypad/7400/include/nexus_keypad.h $
49*
50* 8   2/16/11 1:04p erickson
51* SW7420-1491: add nelem required with nelem_out
52*
53* 7   2/11/11 5:15p erickson
54* SW7420-1491: remove unnecessary nelem
55*
56* 6   12/14/10 3:18p erickson
57* SW7420-1285: add null_allowed attribute
58*
59* 5   5/16/08 2:40p erickson
60* PR35457: update comments
61*
62* 4   2/4/08 4:28p vsilyaev
63* PR 38682: Added more tags for the linux kernel/user proxy mode
64*
65* 3   1/23/08 8:36p vobadm
66* PR35457: update docs
67*
68* 2   1/23/08 5:16p erickson
69* PR35457: update docs
70*
71* 1   1/18/08 2:22p jgarrett
72* PR 38808: Merging to main branch
73*
74* Nexus_Devel/2   11/21/07 11:12a erickson
75* PR37423: update
76*
77* Nexus_Devel/1   11/20/07 5:55p erickson
78* PR37423: added module for ir_blaster, keypad and uhf_input
79*
80* Nexus_Devel/1   9/13/07 5:40p jgarrett
81* PR 34702: Adding keypad API
82*
83***************************************************************************/
84
85#ifndef NEXUS_KEYPAD_H__
86#define NEXUS_KEYPAD_H__
87
88#ifdef __cplusplus
89extern "C" {
90#endif
91
92typedef struct NEXUS_Keypad *NEXUS_KeypadHandle;
93
94/***************************************************************************
95Summary:
96Keypad Device Settings
97***************************************************************************/
98typedef struct NEXUS_KeypadSettings
99{
100    unsigned repeatFilterTime;      /* Key Repeat filter time (in milliseconds) -- events that occur in less than this amount of time will be flagged as repeats */
101    unsigned eventQueueSize;        /* Max number of events that can be queued before an overflow */
102    NEXUS_CallbackDesc dataReady;   /* Data ready callback */
103    uint32_t prescale;              /* 27mhz clock prescale value */
104    uint8_t debounce;               /* debounce count */
105} NEXUS_KeypadSettings;
106
107/***************************************************************************
108Summary:
109Get default settings for a keypad.
110***************************************************************************/
111void NEXUS_Keypad_GetDefaultSettings(
112    NEXUS_KeypadSettings *pSettings    /* [out] */
113    );
114
115/***************************************************************************
116Summary:
117Open a keypad
118***************************************************************************/
119NEXUS_KeypadHandle NEXUS_Keypad_Open( /* attr{destructor=NEXUS_Keypad_Close} */
120    unsigned index,
121    const NEXUS_KeypadSettings *pSettings  /* attr{null_allowed=y} May be passed as NULL for defaults */
122    );
123
124/***************************************************************************
125Summary:
126Close a keypad.
127***************************************************************************/
128void NEXUS_Keypad_Close(
129    NEXUS_KeypadHandle handle
130    );
131
132/***************************************************************************
133Summary:
134Keypad Input Event
135
136Description:
137The Keypad interface does not have a key up event. It reports events when a key is pressed down.
138A key up can be derived by the application by looking for any change in a code or
139an application timeout after not receiving any more codes.
140***************************************************************************/
141typedef struct NEXUS_KeypadEvent
142{
143    bool repeat;        /* If true, this key is a repeated key. */
144    uint16_t code;      /* Code from receiver. The value of the code is platform dependent.
145                           Most platforms return a code which is a bitmask of all keys
146                           that are currently being pressed down. */
147} NEXUS_KeypadEvent;
148
149/***************************************************************************
150Summary:
151Retrieve queued keypad events.
152
153Description:
154This function should be called in response to the dataReady callback.
155The application should repeatedly call this function until numEventsRead returns 0, which means
156the Nexus queue of events is empty.
157
158See Also:
159NEXUS_Keypad_FlushEvents
160***************************************************************************/
161NEXUS_Error NEXUS_Keypad_GetEvents(
162    NEXUS_KeypadHandle handle,
163    NEXUS_KeypadEvent *pEvents,     /* [out] attr{nelem=numEvents;nelem_out=pNumEventsRead;reserved=4} Pointer to an array of events */
164    size_t numEvents,               /* Size of the event array */
165    size_t *pNumEventsRead,         /* [out] Number of events actually read */
166    bool *pOverflow                 /* [out] If true, an internal overflow has occured. The application should increase the NEXUS_KeypadSettings.eventQueueSize
167                                       or call this function more frequently. */
168    );
169
170/***************************************************************************
171Summary:
172Discard all queued events
173***************************************************************************/
174void NEXUS_Keypad_FlushEvents(
175    NEXUS_KeypadHandle handle
176    );
177
178#ifdef __cplusplus
179}
180#endif
181
182#endif /* #ifndef NEXUS_KEYPAD_H__ */
183
Note: See TracBrowser for help on using the repository browser.