diff --git a/demos/device/keyboard/.cproject b/demos/device/keyboard/.cproject
index 9f9b3be7d..14fa2b05e 100644
--- a/demos/device/keyboard/.cproject
+++ b/demos/device/keyboard/.cproject
@@ -18,7 +18,7 @@
-
+
@@ -34,7 +34,7 @@
-
+
+
+
@@ -665,44 +667,46 @@
-
+
-
+
-
+
+
+
-
+
-
+
-
+
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