diff --git a/tinyusb/class/hid.h b/tinyusb/class/hid.h index f6848be6..8b369611 100644 --- a/tinyusb/class/hid.h +++ b/tinyusb/class/hid.h @@ -58,6 +58,16 @@ // TODO refractor #include "common/common.h" +#ifdef TUSB_CFG_DEVICE + #include "device/dcd.h" + #include "hid_device.h" +#endif + +#ifdef TUSB_CFG_HOST + #include "host/usbd_host.h" + #include "hid_host.h" +#endif + /** \struct tusb_mouse_report_t * \brief Standard HID Boot Protocol Mouse Report. * @@ -160,18 +170,6 @@ enum USB_HID_LOCAL_CODE HID_Local_Turkish_F }; -#ifdef TUSB_CFG_DEVICE - #include "device/dcd.h" - #include "hid_device.h" -#endif - -#ifdef TUSB_CFG_HOST - #include "host/usbd_host.h" - #include "hid_host.h" -#endif - - - #ifdef __cplusplus } #endif diff --git a/tinyusb/class/hid_host.c b/tinyusb/class/hid_host.c index d0c3f13e..dbf19b9f 100644 --- a/tinyusb/class/hid_host.c +++ b/tinyusb/class/hid_host.c @@ -35,7 +35,7 @@ * This file is part of the tiny usb stack. */ -#include "hid.h" +#include "hid_host.h" #if defined DEVICE_CLASS_HID && defined TUSB_CFG_HOST diff --git a/tinyusb/class/hid_host.h b/tinyusb/class/hid_host.h index d0dda7a9..d6be47e1 100644 --- a/tinyusb/class/hid_host.h +++ b/tinyusb/class/hid_host.h @@ -60,7 +60,7 @@ tusb_error_t tusbh_keyboard_get(tusb_handle_configure_t const handle, tusb_keyboard_report_t * const report); #ifdef __cplusplus - } +} #endif #endif /* _TUSB_HID_HOST_H_ */ diff --git a/tinyusb/hal/hal.h b/tinyusb/hal/hal.h index 10a5c184..fa0110d9 100644 --- a/tinyusb/hal/hal.h +++ b/tinyusb/hal/hal.h @@ -62,6 +62,17 @@ #define MCU_LPC11UXX 2 #define MCU_LPC43XX 3 +#if MCU == 0 + #error MCU is not defined or supported +#elif MCU == MCU_LPC11UXX + #include "hal_lpc11uxx.h" +#elif MCU == MCU_LPC13UXX + #include "hal_lpc13uxx.h" +#elif MCU == MCU_LPC43XX + #include "hal_lpc43xx.h" +#endif + + /** \brief USB hardware init * * \param[in] para1 @@ -81,16 +92,6 @@ static inline void hal_interrupt_enable() ATTR_ALWAYS_INLINE; */ static inline void hal_interrupt_disable() ATTR_ALWAYS_INLINE; -#if MCU == 0 - #error MCU is not defined or supported -#elif MCU == MCU_LPC11UXX - #include "hal_lpc11uxx.h" -#elif MCU == MCU_LPC13UXX - #include "hal_lpc13uxx.h" -#elif MCU == MCU_LPC43XX - #include "hal_lpc43xx.h" -#endif - #ifdef __cplusplus } #endif diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index 60a3896d..07a65f5b 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -62,6 +62,12 @@ #define TUSB_OS_FREERTOS 3 #define TUSB_OS_UCOS 4 +#if TUSB_CFG_OS == TUSB_OS_NONE + #include "osal_none.h" +#else + #error TUSB_CFG_OS is not defined or OS is not supported yet +#endif + typedef uint32_t osal_status_t; // TODO OSAL port typedef uint32_t osal_timeout_t; // TODO OSAL port @@ -78,12 +84,6 @@ typedef uint32_t osal_queue_id_t; tusb_error_t osal_queue_put(osal_queue_id_t qid, uint32_t data, osal_timeout_t msec); tusb_error_t osal_queue_get(osal_queue_id_t qid, uint32_t *data, osal_timeout_t msec); -#if TUSB_CFG_OS == TUSB_OS_NONE - #include "osal_none.h" -#else - #error TUSB_CFG_OS is not defined or OS is not supported yet -#endif - #ifdef __cplusplus } #endif diff --git a/tinyusb/osal/osal_none.c b/tinyusb/osal/osal_none.c index 309cc5ea..4e18a80e 100644 --- a/tinyusb/osal/osal_none.c +++ b/tinyusb/osal/osal_none.c @@ -35,7 +35,7 @@ * This file is part of the tiny usb stack. */ -#include "osal.h" +#include "osal_none.h" #if TUSB_CFG_OS == TUSB_OS_NONE