diff options
| author | hathach <[email protected]> | 2013-01-11 20:49:46 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-01-11 20:49:46 +0700 |
| commit | e935f29541d1c65a0bd7f480f0ccf0137450f091 (patch) | |
| tree | cbd64175b9e9179345569acf7a867b2a036bcb85 /tinyusb | |
| parent | d76df5400379495d0eb6c6a8301a84042681ea12 (diff) | |
tested keyboard device with lpcXpresso1347 board
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/class/hid.c | 4 | ||||
| -rw-r--r-- | tinyusb/common/common.h | 62 | ||||
| -rw-r--r-- | tinyusb/device/dcd.c | 2 | ||||
| -rw-r--r-- | tinyusb/tusb.h | 2 |
4 files changed, 7 insertions, 63 deletions
diff --git a/tinyusb/class/hid.c b/tinyusb/class/hid.c index b5416faa3..ec2df6156 100644 --- a/tinyusb/class/hid.c +++ b/tinyusb/class/hid.c @@ -41,12 +41,12 @@ #ifdef TUSB_CFG_DEVICE_HID_KEYBOARD USB_HID_KeyboardReport_t hid_keyboard_report; -volatile static bool bKeyChanged = false; +static volatile bool bKeyChanged = false; #endif #ifdef TUSB_CFG_DEVICE_HID_MOUSE USB_HID_MouseReport_t hid_mouse_report; -volatile static bool bMouseChanged = false; +static volatile bool bMouseChanged = false; #endif /**************************************************************************/ diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h index abd0743d0..921de01bc 100644 --- a/tinyusb/common/common.h +++ b/tinyusb/common/common.h @@ -64,6 +64,8 @@ #include "compiler/compiler.h" #include "tusb_option.h" #include "errors.h" +#include "assertion.h" +#include "binary.h" #include "mcu/mcu.h" #include "hal/hal.h" @@ -76,66 +78,6 @@ /// max value #define MAX_(x, y) (((x) > (y)) ? (x) : (y)) -/// n-th Bit -#define BIT_(n) (1 << (n)) - -/// set n-th bit of x to 1 -#define BIT_SET_(x, n) ( (x) | BIT_(n) ) - -/// clear n-th bit of x -#define BIT_CLR_(x, n) ( (x) & (~BIT_(n)) ) - -/// add hex represenation -#define HEX_(n) 0x##n##LU - -// internal macro of B8, B16, B32 -#define _B8__(x) ((x&0x0000000FLU)?1:0) \ - +((x&0x000000F0LU)?2:0) \ - +((x&0x00000F00LU)?4:0) \ - +((x&0x0000F000LU)?8:0) \ - +((x&0x000F0000LU)?16:0) \ - +((x&0x00F00000LU)?32:0) \ - +((x&0x0F000000LU)?64:0) \ - +((x&0xF0000000LU)?128:0) - -#define B8_(d) ((unsigned char)_B8__(HEX_(d))) -#define B16_(dmsb,dlsb) (((unsigned short)B8(dmsb)<<8) + B8(dlsb)) -#define B32_(dmsb,db2,db3,dlsb) \ - (((unsigned long)B8(dmsb)<<24) \ - + ((unsigned long)B8(db2)<<16) \ - + ((unsigned long)B8(db3)<<8) \ - + B8(dlsb)) - - - -//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG ) -#if TUSB_CFG_DEBUG - #define PRINTF(...) printf(__VA_ARGS__) -#else - #define PRINTF(...) -#endif - -#define ASSERT_MESSAGE(condition, value, message) \ - do{\ - if (!(condition)) {\ - PRINTF("Assert at %s %s line %d: %s\n", __BASE_FILE__, __PRETTY_FUNCTION__, __LINE__, message); \ - return (value);\ - }\ - }while(0) - -#define ASSERT(condition, value) ASSERT_MESSAGE(condition, value, NULL) - -#define ASSERT_ERROR_MESSAGE(sts, message) \ - do{\ - TUSB_Error_t status = (TUSB_Error_t)(sts);\ - if (tERROR_NONE != status) {\ - PRINTF("Assert at %s line %d: %s %s\n", __BASE_FILE__, __PRETTY_FUNCTION__, __LINE__, TUSB_ErrorStr[status], message); \ - return status;\ - }\ - }while(0) - -#define ASSERT_ERROR(sts) ASSERT_ERROR_MESSAGE(sts, NULL) - #ifdef __cplusplus } #endif diff --git a/tinyusb/device/dcd.c b/tinyusb/device/dcd.c index 2913fdab0..ea4de2561 100644 --- a/tinyusb/device/dcd.c +++ b/tinyusb/device/dcd.c @@ -47,7 +47,7 @@ #define USB_ROM_SIZE (1024*2) uint8_t usb_RomDriver_buffer[USB_ROM_SIZE] ATTR_ALIGNED(2048) __DATA(RAM2); USBD_HANDLE_T g_hUsb; -volatile static bool isConfigured = false; +static volatile bool isConfigured = false; /**************************************************************************/ /*! diff --git a/tinyusb/tusb.h b/tinyusb/tusb.h index a706e9c32..9eb153371 100644 --- a/tinyusb/tusb.h +++ b/tinyusb/tusb.h @@ -66,6 +66,8 @@ #include "class/cdc.h" #endif +TUSB_Error_t tusb_init(void); + #ifdef __cplusplus } #endif |
