Add system keyboard interface and add sleep, power and wake keys.
This commit is contained in:
44
right/src/usb_interfaces/usb_interface_system_keyboard.h
Normal file
44
right/src/usb_interfaces/usb_interface_system_keyboard.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef __USB_INTERFACE_SYSTEM_KEYBOARD_H__
|
||||
#define __USB_INTERFACE_SYSTEM_KEYBOARD_H__
|
||||
|
||||
// Includes:
|
||||
|
||||
#include "fsl_common.h"
|
||||
#include "usb_api.h"
|
||||
#include "usb_descriptors/usb_descriptor_system_keyboard_report.h"
|
||||
|
||||
// Macros:
|
||||
|
||||
#define USB_SYSTEM_KEYBOARD_INTERFACE_INDEX 4
|
||||
#define USB_SYSTEM_KEYBOARD_INTERFACE_COUNT 1
|
||||
|
||||
#define USB_SYSTEM_KEYBOARD_ENDPOINT_INDEX 6
|
||||
#define USB_SYSTEM_KEYBOARD_ENDPOINT_COUNT 1
|
||||
|
||||
#define USB_SYSTEM_KEYBOARD_INTERRUPT_IN_PACKET_SIZE 1
|
||||
#define USB_SYSTEM_KEYBOARD_INTERRUPT_IN_INTERVAL 4
|
||||
|
||||
#define USB_SYSTEM_KEYBOARD_REPORT_LENGTH 1
|
||||
|
||||
// Typedefs:
|
||||
|
||||
typedef struct {
|
||||
uint8_t scancodes[USB_SYSTEM_KEYBOARD_MAX_KEYS];
|
||||
} __attribute__ ((packed)) usb_system_keyboard_report_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
extern bool IsUsbSystemKeyboardReportSent;
|
||||
extern usb_device_class_struct_t UsbSystemKeyboardClass;
|
||||
extern usb_system_keyboard_report_t* ActiveUsbSystemKeyboardReport;
|
||||
|
||||
// Functions:
|
||||
|
||||
extern usb_status_t UsbSystemKeyboardCallback(class_handle_t handle, uint32_t event, void *param);
|
||||
extern usb_status_t UsbSystemKeyboardSetConfiguration(class_handle_t handle, uint8_t configuration);
|
||||
extern usb_status_t UsbSystemKeyboardSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting);
|
||||
|
||||
extern void ResetActiveUsbSystemKeyboardReport();
|
||||
extern void SwitchActiveUsbSystemKeyboardReport();
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user