PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
UsbDeviceHidKeyboard.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2013 Spansion LLC. All Rights Reserved.
3 *
4 * This software is owned and published by:
5 * Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion").
6 *
7 * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
8 * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
9 *
10 * This software contains source code for use with Spansion
11 * components. This software is licensed by Spansion to be adapted only
12 * for use in systems utilizing Spansion components. Spansion shall not be
13 * responsible for misuse or illegal use of this software for devices not
14 * supported herein. Spansion is providing this software "AS IS" and will
15 * not be responsible for issues arising from incorrect user implementation
16 * of the software.
17 *
18 * SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
19 * REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
20 * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
21 * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
22 * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
23 * WARRANTY OF NONINFRINGEMENT.
24 * SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
25 * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
26 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
27 * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
28 * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
30 * SAVINGS OR PROFITS,
31 * EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
33 * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
34 * FROM, THE SOFTWARE.
35 *
36 * This software may be replicated in part or whole for the licensed use,
37 * with the restriction that this Disclaimer and Copyright notice must be
38 * included with each copy of this software, whether used in part or whole,
39 * at all times.
40 */
41 /******************************************************************************/
54 #ifndef __USBDEVICEHIDKEYBOARD_H__
55 #define __USBDEVICEHIDKEYBOARD_H__
56 
57 /*****************************************************************************/
58 /* Include files */
59 /*****************************************************************************/
60 
61 #include "usb.h"
62 
63 #ifndef USBDEVICEHIDKEYBOARD_ENABLED
64  #define USBDEVICEHIDKEYBOARD_ENABLED OFF
65 #endif
66 
67 #if ((FM_PERIPHERAL_USB_DEVICE_ENABLED == ON) && (USBDEVICEHIDKEYBOARD_ENABLED == ON))
68 
69 #include "usbdevice.h"
70 
71 /* C binding of definitions if building with C++ compiler */
72 #ifdef __cplusplus
73 extern "C"
74 {
75 #endif
76 
95 
96 extern const uint8_t u8AsciiToKeyCode[];
97 
98 /*****************************************************************************/
99 /* Global pre-processor symbols/macros ('#define') */
100 /*****************************************************************************/
101 
102 
103 
104 #ifndef MODIFIERKEY_LEFT_CTRL
105 #define MODIFIERKEY_LEFT_CTRL (1 << 0)
106 #endif
107 #ifndef MODIFIERKEY_LEFT_SHIFT
108 #define MODIFIERKEY_LEFT_SHIFT (1 << 1)
109 #endif
110 #ifndef MODIFIERKEY_LEFT_ALT
111 #define MODIFIERKEY_LEFT_ALT (1 << 2)
112 #endif
113 #ifndef MODIFIERKEY_LEFT_GUI
114 #define MODIFIERKEY_LEFT_GUI (1 << 3)
115 #endif
116 
117 #ifndef MODIFIERKEY_RIGHT_CTRL
118 #define MODIFIERKEY_RIGHT_CTRL (1 << 4)
119 #endif
120 #ifndef MODIFIERKEY_RIGHT_SHIFT
121 #define MODIFIERKEY_RIGHT_SHIFT (1 << 5)
122 #endif
123 #ifndef MODIFIERKEY_RIGHT_ALT
124 #define MODIFIERKEY_RIGHT_ALT (1 << 6)
125 #endif
126 #ifndef MODIFIERKEY_RIGHT_GUI
127 #define MODIFIERKEY_RIGHT_GUI (1 << 7)
128 #endif
129 
130 /*****************************************************************************/
131 /* Global type definitions ('typedef') */
132 /*****************************************************************************/
133 
135 {
136  uint8_t u8ModifierKeys;
137  uint8_t u8Reserved;
138  uint8_t u8KeyCode1;
139  uint8_t u8KeyCode2;
140  uint8_t u8KeyCode3;
141  uint8_t u8KeyCode4;
142  uint8_t u8KeyCode5;
143  uint8_t u8KeyCode6;
145 
146 /*****************************************************************************/
147 /* Global variable declarations ('extern', definition in C source) */
148 /*****************************************************************************/
149 
150 
151 
152 /*****************************************************************************/
153 /* Global function prototypes ('extern', definition in C source) */
154 /*****************************************************************************/
155 
156 void UsbDeviceHidKeyboard_Init(stc_usbn_t* pstcUsb);
157 void UsbDeviceHidKeyboard_SetModifierKey(uint8_t u8ModifierKey);
158 void UsbDeviceHidKeyboard_ClearModifierKey(uint8_t u8ModifierKey);
159 void UsbDeviceHidKeyboard_KeyPress(uint8_t u8Index, uint8_t u8KeyCode);
160 void UsbDeviceHidKeyboard_KeyDown(uint8_t u8Index, uint8_t u8KeyCode);
161 void UsbDeviceHidKeyboard_KeyUp(uint8_t u8Index, uint8_t u8KeyCode);
162 
164 #ifdef __cplusplus
165 }
166 #endif
167 
169 #else
170  #define UsbDeviceHidKeyboard_Init(x) ;
171 #endif
172 
173 #endif /* __UsbDeviceHidKeyboard__*/
174