mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-14 04:18:56 +00:00
add more doxygen docs
start to use TUSB_Error_t
This commit is contained in:
parent
382cd30be2
commit
360b28b44f
@ -46,6 +46,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/tinyusb}""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.include.files.141853359" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files"/>
|
||||
<option id="gnu.c.compiler.option.warnings.pedantic.161351038" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="false" valueType="boolean"/>
|
||||
<inputType id="com.crt.advproject.compiler.input.677402070" superClass="com.crt.advproject.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="com.crt.advproject.gas.lib.debug.111062522" name="MCU Assembler" superClass="com.crt.advproject.gas.lib.debug">
|
||||
|
11
.project
11
.project
@ -78,4 +78,15 @@
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1354161221797</id>
|
||||
<name>html</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-index.htm?</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
|
1808
doxygen.Doxyfile
Normal file
1808
doxygen.Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@ -180,7 +180,7 @@ ErrorCode_t HID_EpOut_Hdlr (USBD_HANDLE_T hUsb, void* data, uint32_t event)
|
||||
@brief Initialises USB HID using the ROM based drivers
|
||||
*/
|
||||
/**************************************************************************/
|
||||
ErrorCode_t usb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size)
|
||||
TUSB_Error_t usb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size)
|
||||
{
|
||||
USB_HID_REPORT_T reports_data =
|
||||
{
|
||||
@ -207,7 +207,7 @@ ErrorCode_t usb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *con
|
||||
|
||||
ASSERT( (pIntfDesc != NULL) && (pIntfDesc->bInterfaceClass == USB_DEVICE_CLASS_HUMAN_INTERFACE), ERR_FAILED);
|
||||
|
||||
ASSERT_STATUS( USBD_API->hid->init(hUsb, &hid_param) );
|
||||
ASSERT( LPC_OK == USBD_API->hid->init(hUsb, &hid_param), tERROR_FAILED );
|
||||
|
||||
/* update memory variables */
|
||||
*mem_base += (*mem_size - hid_param.mem_size);
|
||||
@ -221,7 +221,7 @@ ErrorCode_t usb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *con
|
||||
|
||||
*/
|
||||
/**************************************************************************/
|
||||
ErrorCode_t usb_hid_configured(USBD_HANDLE_T hUsb)
|
||||
TUSB_Error_t usb_hid_configured(USBD_HANDLE_T hUsb)
|
||||
{
|
||||
#ifdef CFG_CLASS_HID_KEYBOARD
|
||||
USBD_API->hw->WriteEP(hUsb , HID_KEYBOARD_EP_IN , (uint8_t* ) &hid_keyboard_report , sizeof(USB_HID_KeyboardReport_t) ); // initial packet for IN endpoint , will not work if omitted
|
||||
@ -231,7 +231,7 @@ ErrorCode_t usb_hid_configured(USBD_HANDLE_T hUsb)
|
||||
USBD_API->hw->WriteEP(hUsb , HID_MOUSE_EP_IN , (uint8_t* ) &hid_mouse_report , sizeof(USB_HID_MouseReport_t) ); // initial packet for IN endpoint, will not work if omitted
|
||||
#endif
|
||||
|
||||
return LPC_OK;
|
||||
return tERROR_NONE;
|
||||
}
|
||||
|
||||
#ifdef CFG_CLASS_HID_KEYBOARD
|
||||
@ -271,13 +271,19 @@ ErrorCode_t usb_hid_configured(USBD_HANDLE_T hUsb)
|
||||
@endcode
|
||||
*/
|
||||
/**************************************************************************/
|
||||
ErrorCode_t usb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey)
|
||||
TUSB_Error_t usb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey)
|
||||
{
|
||||
uint32_t start_time = systickGetSecondsActive();
|
||||
while (bKeyChanged) // TODO blocking while previous key has yet sent - can use fifo to improve this
|
||||
// uint32_t start_time = systickGetSecondsActive();
|
||||
// while (bKeyChanged) // TODO blocking while previous key has yet sent - can use fifo to improve this
|
||||
// {
|
||||
// ASSERT_MESSAGE(systickGetSecondsActive() - start_time < 5, ERR_FAILED, "HID Keyboard Timeout");
|
||||
// }
|
||||
|
||||
if (bKeyChanged)
|
||||
{
|
||||
ASSERT_MESSAGE(systickGetSecondsActive() - start_time < 5, ERR_FAILED, "HID Keyboard Timeout");
|
||||
return tERROR_FAILED;
|
||||
}
|
||||
|
||||
ASSERT(keycodes && numkey && numkey <=6, ERR_FAILED);
|
||||
|
||||
hid_keyboard_report.Modifier = modifier;
|
||||
@ -316,12 +322,17 @@ ErrorCode_t usb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint
|
||||
@endcode
|
||||
*/
|
||||
/**************************************************************************/
|
||||
ErrorCode_t usb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y)
|
||||
TUSB_Error_t usb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y)
|
||||
{
|
||||
uint32_t start_time = systickGetSecondsActive();
|
||||
while (bMouseChanged) // TODO Block while previous key hasn't been sent - can use fifo to improve this
|
||||
// uint32_t start_time = systickGetSecondsActive();
|
||||
// while (bMouseChanged) // TODO Block while previous key hasn't been sent - can use fifo to improve this
|
||||
// {
|
||||
// ASSERT_MESSAGE(systickGetSecondsActive() - start_time < 5, ERR_FAILED, "HID Mouse Timeout");
|
||||
// }
|
||||
|
||||
if (bMouseChanged)
|
||||
{
|
||||
ASSERT_MESSAGE(systickGetSecondsActive() - start_time < 5, ERR_FAILED, "HID Mouse Timeout");
|
||||
return tERROR_FAILED;
|
||||
}
|
||||
|
||||
hid_mouse_report.Button = buttons;
|
||||
|
@ -46,11 +46,11 @@
|
||||
#include "common/common.h"
|
||||
#include "device/dcd.h"
|
||||
|
||||
ErrorCode_t usb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size);
|
||||
ErrorCode_t usb_hid_configured(USBD_HANDLE_T hUsb);
|
||||
TUSB_Error_t usb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size) ATTR_NON_NULL;
|
||||
TUSB_Error_t usb_hid_configured(USBD_HANDLE_T hUsb);
|
||||
|
||||
ErrorCode_t usb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey);
|
||||
ErrorCode_t usb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y);
|
||||
TUSB_Error_t usb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey) ATTR_NON_NULL;
|
||||
TUSB_Error_t usb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y);
|
||||
|
||||
/** \brief Standard HID Boot Protocol Mouse Report.
|
||||
*
|
||||
|
@ -65,3 +65,5 @@
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_ARCH_H_ */
|
||||
|
||||
/** @{ */
|
||||
|
@ -41,7 +41,7 @@
|
||||
* \note TBD
|
||||
*/
|
||||
|
||||
/** \ingroup Group_TinyUSB
|
||||
/**
|
||||
* \defgroup Group_Common Common Files
|
||||
* \brief Group_Common brief
|
||||
*
|
||||
@ -54,37 +54,41 @@
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "tusb_cfg.h"
|
||||
#include "arch/arch.h"
|
||||
#include "compiler/compiler.h"
|
||||
#include "errors.h"
|
||||
|
||||
//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
|
||||
#if 1 // TODO refractor ASSERT
|
||||
#define PRINTF_LOCATION(mess) printf("Assert: %s at line %d: %s\n", __func__, __LINE__, mess)
|
||||
#if CFG_TUSB_DEBUG_LEVEL
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF_LOCATION(mess)
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
|
||||
#define ASSERT_MESSAGE(condition, value, message) \
|
||||
do{\
|
||||
if (!(condition)) {\
|
||||
PRINTF_LOCATION(message);\
|
||||
PRINTF("Assert at %s line %d: %s\n", __func__, __LINE__, message); \
|
||||
return (value);\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define ASSERT(condition, value) ASSERT_MESSAGE(condition, value, NULL)
|
||||
|
||||
#define ASSERT_STATUS_MESSAGE(sts, message) \
|
||||
#define ASSERT_ERROR_MESSAGE(sts, message) \
|
||||
do{\
|
||||
ErrorCode_t status = (sts);\
|
||||
if (LPC_OK != status) {\
|
||||
PRINTF_LOCATION(message);\
|
||||
TUSB_Error_t status = (TUSB_Error_t)(sts);\
|
||||
if (tERROR_NONE != status) {\
|
||||
PRINTF("Assert at %s line %d: %s %s\n", __func__, __LINE__, TUSB_ErrorStr[status], message); \
|
||||
return status;\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define ASSERT_STATUS(sts) ASSERT_STATUS_MESSAGE(sts, NULL)
|
||||
#define ASSERT_ERROR(sts) ASSERT_ERROR_MESSAGE(sts, NULL)
|
||||
|
||||
#endif /* _TUSB_COMMON_H_ */
|
||||
|
||||
/** @{ */
|
||||
|
@ -39,4 +39,5 @@ char const* const TUSB_ErrorStr[] = {
|
||||
# define ERROR_ENUM(x) #x,
|
||||
# include "errors_def"
|
||||
# undef ERROR_ENUM
|
||||
0
|
||||
};
|
||||
|
@ -42,23 +42,29 @@
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
*
|
||||
* \defgroup Group_Error tinyUSB Error Codes
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_ERRORS_H_
|
||||
#define _TUSB_ERRORS_H_
|
||||
|
||||
enum TUSB_ERROR {
|
||||
/** \enum TUSB_Error
|
||||
* \brief Error Code returned
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
# define ERROR_ENUM(x) x,
|
||||
# include "errors_def"
|
||||
# undef ERROR_ENUM
|
||||
};
|
||||
ERROR_COUNT
|
||||
}TUSB_Error_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG_LEVEL > 0
|
||||
extern char const* const TUSB_ErrorStr[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -66,3 +72,5 @@ extern char const* const TUSB_ErrorStr[];
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_ERRORS_H_ */
|
||||
|
||||
/** @{ */
|
||||
|
39
tinyusb/common/errors_def
Normal file
39
tinyusb/common/errors_def
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* errors_def
|
||||
*
|
||||
* Created on: Nov 27, 2012
|
||||
* Author: hathach (thachha@live.com)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
* Copyright (c) 2012, hathach (thachha@live.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the tiny usb stack.
|
||||
*/
|
||||
|
||||
ERROR_ENUM(tERROR_NONE)
|
||||
ERROR_ENUM(tERROR_FAILED)
|
@ -51,10 +51,10 @@
|
||||
|
||||
#include "common/common.h"
|
||||
|
||||
/**
|
||||
* \brief Simple FIFO
|
||||
/** \struct fifo_t
|
||||
* \brief Simple Circular FIFO
|
||||
*/
|
||||
typedef struct
|
||||
typedef struct _fifo_t
|
||||
{
|
||||
uint8_t* buf; ///< buffer pointer
|
||||
uint16_t size; ///< buffer size
|
||||
|
@ -57,7 +57,7 @@ ErrorCode_t USB_Configure_Event (USBD_HANDLE_T hUsb)
|
||||
if (pCtrl->config_value)
|
||||
{
|
||||
#if defined(CLASS_HID)
|
||||
ASSERT_STATUS( usb_hid_configured(hUsb) );
|
||||
ASSERT( tERROR_NONE == usb_hid_configured(hUsb), ERR_FAILED );
|
||||
#endif
|
||||
|
||||
#ifdef CFG_USB_CDC
|
||||
@ -81,7 +81,7 @@ ErrorCode_t USB_Reset_Event (USBD_HANDLE_T hUsb)
|
||||
return LPC_OK;
|
||||
}
|
||||
|
||||
void dcd_init()
|
||||
TUSB_Error_t dcd_init()
|
||||
{
|
||||
/* ROM DRIVER INIT */
|
||||
uint32_t membase = (uint32_t) usb_RomDriver_buffer;
|
||||
@ -107,26 +107,26 @@ void dcd_init()
|
||||
.device_qualifier = NULL
|
||||
};
|
||||
|
||||
/* Start USB hardware initialisation */
|
||||
ASSERT_STATUS(USBD_API->hw->Init(&g_hUsb, &DeviceDes, &usb_param));
|
||||
/* USB hardware core initialization */
|
||||
ASSERT(LPC_OK == USBD_API->hw->Init(&g_hUsb, &DeviceDes, &usb_param), tERROR_FAILED);
|
||||
|
||||
membase += (memsize - usb_param.mem_size);
|
||||
memsize = usb_param.mem_size;
|
||||
|
||||
/* Initialise the class driver(s) */
|
||||
#ifdef CFG_USB_CDC
|
||||
ASSERT_STATUS( usb_cdc_init(g_hUsb, &USB_FsConfigDescriptor.CDC_CCI_Interface,
|
||||
#ifdef CFG_CLASS_CDC
|
||||
ASSERT_ERROR( usb_cdc_init(g_hUsb, &USB_FsConfigDescriptor.CDC_CCI_Interface,
|
||||
&USB_FsConfigDescriptor.CDC_DCI_Interface, &membase, &memsize) );
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_KEYBOARD
|
||||
ASSERT_STATUS( usb_hid_init(g_hUsb , &USB_FsConfigDescriptor.HID_KeyboardInterface ,
|
||||
ASSERT_ERROR( usb_hid_init(g_hUsb , &USB_FsConfigDescriptor.HID_KeyboardInterface ,
|
||||
HID_KeyboardReportDescriptor, USB_FsConfigDescriptor.HID_KeyboardHID.DescriptorList[0].wDescriptorLength,
|
||||
&membase , &memsize) );
|
||||
#endif
|
||||
|
||||
#ifdef CFG_USB_HID_MOUSE
|
||||
ASSERT_STATUS( usb_hid_init(g_hUsb , &USB_FsConfigDescriptor.HID_MouseInterface ,
|
||||
#ifdef CFG_CLASS_HID_MOUSE
|
||||
ASSERT_ERROR( usb_hid_init(g_hUsb , &USB_FsConfigDescriptor.HID_MouseInterface ,
|
||||
HID_MouseReportDescriptor, USB_FsConfigDescriptor.HID_MouseHID.DescriptorList[0].wDescriptorLength,
|
||||
&membase , &memsize) );
|
||||
#endif
|
||||
@ -136,6 +136,8 @@ void dcd_init()
|
||||
|
||||
/* Perform USB soft connect */
|
||||
USBD_API->hw->Connect(g_hUsb, 1);
|
||||
|
||||
return tERROR_NONE;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
@ -38,11 +38,7 @@
|
||||
#ifndef _TUSB_DCD_H_
|
||||
#define _TUSB_DCD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "tusb_cfg.h"
|
||||
#include "common/common.h"
|
||||
|
||||
#ifdef DEVICE_ROMDRIVER
|
||||
@ -51,6 +47,11 @@
|
||||
#define USBD_API ((*(ROM **)(0x1FFF1FF8))->pUSBD) // TODO HAL
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
TUSB_Error_t dcd_init() ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
45
tinyusb/host/hcd.c
Normal file
45
tinyusb/host/hcd.c
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* hcd.c
|
||||
*
|
||||
* Created on: Nov 29, 2012
|
||||
* Author: hathach (thachha@live.com)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
* Copyright (c) 2012, hathach (thachha@live.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the tiny usb stack.
|
||||
*/
|
||||
|
||||
#include "hcd.h"
|
||||
|
||||
TUSB_Error_t hcd_init()
|
||||
{
|
||||
|
||||
|
||||
return tERROR_NONE;
|
||||
}
|
@ -38,10 +38,14 @@
|
||||
#ifndef _TUSB_HCD_H_
|
||||
#define _TUSB_HCD_H_
|
||||
|
||||
#include "common/common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
TUSB_Error_t hcd_init() ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -37,11 +37,7 @@
|
||||
|
||||
#include "tusb.h"
|
||||
|
||||
#ifdef CFG_TUSB_DEVICE
|
||||
#include "device/dcd.h"
|
||||
#endif
|
||||
|
||||
ErrorCode_t tusb_init(void)
|
||||
TUSB_Error_t tusb_init(void)
|
||||
{
|
||||
/* HARDWARE INIT */
|
||||
|
||||
@ -55,8 +51,13 @@ ErrorCode_t tusb_init(void)
|
||||
LPC_IOCON->PIO0_6 &= ~0x07;
|
||||
LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
|
||||
|
||||
#ifdef CFG_TUSB_DEVICE
|
||||
dcd_init();
|
||||
#ifdef CFG_TUSB_HOST
|
||||
ASSERT_ERROR( hcd_init() );
|
||||
#endif
|
||||
|
||||
#ifdef CFG_TUSB_DEVICE
|
||||
ASSERT_ERROR( dcd_init() );
|
||||
#endif
|
||||
|
||||
return LPC_OK;
|
||||
}
|
||||
|
@ -55,7 +55,10 @@
|
||||
#endif
|
||||
|
||||
#include "common/common.h"
|
||||
#include "tusb_cfg.h"
|
||||
|
||||
#ifdef CFG_TUSB_HOST
|
||||
#include "host/hcd.h"
|
||||
#endif
|
||||
|
||||
#ifdef CFG_TUSB_DEVICE
|
||||
#include "device/dcd.h"
|
||||
|
@ -42,16 +42,24 @@
|
||||
*/
|
||||
|
||||
/** \ingroup Group_TinyUSB
|
||||
*
|
||||
* \defgroup Group_TinyUSB_Configure Configuration tusb_cfg.h
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_CFG_H_
|
||||
#define _TUSB_CFG_H_
|
||||
|
||||
#define CFG_TUSB_HOST ///< Enable Host Support
|
||||
#define CFG_TUSB_DEVICE ///< Enable Device Support
|
||||
#define CFG_CLASS_HID_KEYBOARD ///< Enable HID Keyboard support
|
||||
/// 0: no debug infor 3: most debug infor provided
|
||||
#define CFG_TUSB_DEBUG_LEVEL 3
|
||||
|
||||
/// Enable Host Support
|
||||
#define CFG_TUSB_HOST
|
||||
|
||||
/// Enable Device Support
|
||||
#define CFG_TUSB_DEVICE
|
||||
|
||||
/// Enable HID Keyboard support
|
||||
#define CFG_CLASS_HID_KEYBOARD
|
||||
|
||||
#define CLASS_HID (defined CFG_CLASS_HID_KEYBOARD)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user