Extract USB_*_INTERFACE_COUNT macros to usb_interface_*.h files and make usb_device_config.h use them along with USB_*_ENDPOINT_COUNT macros.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
|
||||
// Includes:
|
||||
|
||||
#include "usb_device_config.h"
|
||||
#include "usb.h"
|
||||
#include "usb_device.h"
|
||||
#include "ksdk_usb/usb_device_class.h"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "fsl_common.h"
|
||||
#include "usb_api.h"
|
||||
#include "usb_device_config.h"
|
||||
#include "usb_composite_device.h"
|
||||
#include "usb_descriptors/usb_descriptor_hid.h"
|
||||
#include "usb_descriptors/usb_descriptor_strings.h"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
// Includes:
|
||||
|
||||
#include "usb_descriptors/usb_descriptor_configuration.h"
|
||||
#include "usb_device_config.h"
|
||||
#include "usb_device.h"
|
||||
|
||||
// Macros:
|
||||
|
||||
|
||||
@@ -4,16 +4,21 @@
|
||||
// KHCI instance count
|
||||
#define USB_DEVICE_CONFIG_KHCI 1
|
||||
|
||||
#include "usb_interfaces/usb_interface_basic_keyboard.h"
|
||||
#include "usb_interfaces/usb_interface_media_keyboard.h"
|
||||
#include "usb_interfaces/usb_interface_mouse.h"
|
||||
#include "usb_interfaces/usb_interface_generic_hid.h"
|
||||
|
||||
// Device instance count, the sum of KHCI and EHCI instance counts
|
||||
#define USB_DEVICE_CONFIG_NUM 1
|
||||
|
||||
// HID instance count
|
||||
#define USB_BASIC_KEYBOARD_INTERFACE_COUNT 1
|
||||
#define USB_MEDIA_KEYBOARD_INTERFACE_COUNT 1
|
||||
#define USB_MOUSE_INTERFACE_COUNT 1
|
||||
#define USB_GENERIC_HID_INTERFACE_COUNT 1
|
||||
#define USB_DEVICE_CONFIG_HID \
|
||||
(USB_BASIC_KEYBOARD_INTERFACE_COUNT + USB_MEDIA_KEYBOARD_INTERFACE_COUNT + USB_MOUSE_INTERFACE_COUNT + USB_GENERIC_HID_INTERFACE_COUNT)
|
||||
#define USB_DEVICE_CONFIG_HID ( \
|
||||
USB_BASIC_KEYBOARD_INTERFACE_COUNT + \
|
||||
USB_MEDIA_KEYBOARD_INTERFACE_COUNT + \
|
||||
USB_MOUSE_INTERFACE_COUNT + \
|
||||
USB_GENERIC_HID_INTERFACE_COUNT \
|
||||
)
|
||||
|
||||
// Whether the device is self-powered: 1 supported, 0 not supported
|
||||
#define USB_DEVICE_CONFIG_SELF_POWER 1
|
||||
@@ -21,8 +26,17 @@
|
||||
// Whether device remote wakeup supported: 1 supported, 0 not supported
|
||||
#define USB_DEVICE_CONFIG_REMOTE_WAKEUP 0
|
||||
|
||||
// The number of control endpoints, which is always 1
|
||||
#define USB_CONTROL_ENDPOINT_COUNT 1
|
||||
|
||||
// How many endpoints are supported in the stack
|
||||
#define USB_DEVICE_CONFIG_ENDPOINTS 6
|
||||
#define USB_DEVICE_CONFIG_ENDPOINTS ( \
|
||||
USB_CONTROL_ENDPOINT_COUNT + \
|
||||
USB_BASIC_KEYBOARD_ENDPOINT_COUNT + \
|
||||
USB_MEDIA_KEYBOARD_ENDPOINT_COUNT + \
|
||||
USB_MOUSE_ENDPOINT_COUNT + \
|
||||
USB_GENERIC_HID_ENDPOINT_COUNT \
|
||||
)
|
||||
|
||||
// The maximum buffer length for the KHCI DMA workaround
|
||||
#define USB_DEVICE_CONFIG_KHCI_DMA_ALIGN_BUFFER_LENGTH 64
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// Macros:
|
||||
|
||||
#define USB_BASIC_KEYBOARD_INTERFACE_INDEX 1
|
||||
#define USB_BASIC_KEYBOARD_INTERFACE_COUNT 1
|
||||
|
||||
#define USB_BASIC_KEYBOARD_ENDPOINT_INDEX 3
|
||||
#define USB_BASIC_KEYBOARD_ENDPOINT_COUNT 1
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// Macros:
|
||||
|
||||
#define USB_GENERIC_HID_INTERFACE_INDEX 0
|
||||
#define USB_GENERIC_HID_INTERFACE_COUNT 1
|
||||
|
||||
#define USB_GENERIC_HID_ENDPOINT_IN_INDEX 1
|
||||
#define USB_GENERIC_HID_ENDPOINT_OUT_INDEX 2
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// Macros:
|
||||
|
||||
#define USB_MEDIA_KEYBOARD_INTERFACE_INDEX 3
|
||||
#define USB_MEDIA_KEYBOARD_INTERFACE_COUNT 1
|
||||
|
||||
#define USB_MEDIA_KEYBOARD_ENDPOINT_INDEX 5
|
||||
#define USB_MEDIA_KEYBOARD_ENDPOINT_COUNT 1
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
// Macros:
|
||||
|
||||
#define USB_MOUSE_INTERFACE_INDEX 2
|
||||
#define USB_MOUSE_INTERFACE_COUNT 1
|
||||
|
||||
#define USB_MOUSE_ENDPOINT_INDEX 4
|
||||
#define USB_MOUSE_ENDPOINT_COUNT 1
|
||||
|
||||
Reference in New Issue
Block a user