-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhidmouse.h
85 lines (72 loc) · 3 KB
/
hidmouse.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/***************************************************************************//**
* @file hidkbd.h
* @brief USB Human Interface Devices (HID) class keyboard driver.
* @version 3.20.12
*******************************************************************************
* @section License
* <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
*******************************************************************************
*
* This file is licensed under the Silabs License Agreement. See the file
* "Silabs_License_Agreement.txt" for details. Before using this software for
* any purpose, you must agree to the terms of that agreement.
*
******************************************************************************/
#ifndef __SILICON_LABS_HIDKBD_H__
#define __SILICON_LABS_HIDKBD_H__
/***************************************************************************//**
* @addtogroup Drivers
* @{
******************************************************************************/
/***************************************************************************//**
* @addtogroup HidKeyboard
* @{
******************************************************************************/
#include <stdint.h>
#include "em_usb.h"
#ifdef __cplusplus
extern "C" {
#endif
/** HID keyboard input report definition. */
EFM32_PACK_START( 1 )
typedef struct
{
uint8_t buttons;
uint8_t xaxis;
uint8_t yaxis;
} __attribute__ ((packed)) HIDKBD_MouseReport_t;
EFM32_PACK_END()
/**************************************************************************//**
* @brief
* Callback function pointer for HID output reports.
* This function will be called by the driver each time an output report is
* received by the device.
*
* @param[in] report Output report byte.
* @n Bit 0 : State of keyboard NumLock LED.
* @n Bit 1 : State of keyboard CapsLock LED.
* @n Bit 2 : State of keyboard ScrollLock LED.
*****************************************************************************/
typedef void (*HIDKBD_SetReportFunc_t)( uint8_t report );
/** HidKeyboard driver initialization structure.
* This data structure contains configuration options that the driver
* needs. The structure must be passed to @ref HIDKBD_Init() when initializing
* the driver.
*/
typedef struct
{
void *hidDescriptor; /**< Pointer to the HID class descriptor in the user application. */
HIDKBD_SetReportFunc_t setReportFunc; /**< Callback function pointer for HID output reports, may be NULL when no callback is needed. */
} HIDKBD_Init_t;
extern const char HIDKBD_MouseReportDescriptor[ 50 ];
void HIDKBD_Init( HIDKBD_Init_t *init );
int HIDKBD_SetupCmd( const USB_Setup_TypeDef *setup );
void HIDKBD_StateChangeEvent( USBD_State_TypeDef oldState,
USBD_State_TypeDef newState );
void HIDKBD_MouseEvent( HIDKBD_MouseReport_t *report );
#ifdef __cplusplus
}
#endif
/** @} (end group HidKeyboard) */
/** @} (end group Drivers) */
#endif /* __SILICON_LABS_HIDKBD_H__ */