diff --git a/tinyusb/common/arch/arch.h b/tinyusb/common/arch/arch.h index 9a48864e7..8580d4208 100644 --- a/tinyusb/common/arch/arch.h +++ b/tinyusb/common/arch/arch.h @@ -38,6 +38,10 @@ #ifndef _TUSB_ARCH_H_ #define _TUSB_ARCH_H_ +#ifdef __cplusplus + extern "C" { +#endif + #define ARCH_LPC134X 1 #define ARCH_LPC43XX 2 #define ARCH ARCH_LPC134X @@ -51,4 +55,8 @@ #endif +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_ARCH_H_ */ diff --git a/tinyusb/common/arch/arch_lpc134x.h b/tinyusb/common/arch/arch_lpc134x.h index 14002161f..050fb3148 100644 --- a/tinyusb/common/arch/arch_lpc134x.h +++ b/tinyusb/common/arch/arch_lpc134x.h @@ -38,10 +38,18 @@ #ifndef _TUSB_ARCH_LPC134_X_H_ #define _TUSB_ARCH_LPC134_X_H_ +#ifdef __cplusplus + extern "C" { +#endif + #include "arm_mx.h" #define ARM ARM_M3 #define DEVICE_ROMDRIVER +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_ARCH_LPC134_X_H_ */ diff --git a/tinyusb/common/arch/arch_lpc43xx.h b/tinyusb/common/arch/arch_lpc43xx.h index 9af504457..aa137036d 100644 --- a/tinyusb/common/arch/arch_lpc43xx.h +++ b/tinyusb/common/arch/arch_lpc43xx.h @@ -38,9 +38,17 @@ #ifndef _TUSB_ARCH_LPC43XX_H_ #define _TUSB_ARCH_LPC43XX_H_ +#ifdef __cplusplus + extern "C" { +#endif + #define ARM ARM_M4 //#define ARM ARM_M0 #include "arm_mx.h" +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_ARCH_LPC43XX_H_ */ diff --git a/tinyusb/common/arch/arm_mx.h b/tinyusb/common/arch/arm_mx.h index 5546193eb..760eea9c9 100644 --- a/tinyusb/common/arch/arm_mx.h +++ b/tinyusb/common/arch/arm_mx.h @@ -38,7 +38,15 @@ #ifndef _TUSB_ARM_MX_H_ #define _TUSB_ARM_MX_H_ +#ifdef __cplusplus + extern "C" { +#endif + #define ENDIAN_LITTLE #define ALIGNMENT (4) +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_ARM_MX_H_ */ diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h index 40508b6fa..03d6387d7 100644 --- a/tinyusb/common/common.h +++ b/tinyusb/common/common.h @@ -38,8 +38,16 @@ #ifndef _TUSB_COMMON_H_ #define _TUSB_COMMON_H_ +#ifdef __cplusplus + extern "C" { +#endif + #include "arch/arch.h" #include "compiler/compiler.h" #include "errors.h" +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_COMMON_H_ */ diff --git a/tinyusb/common/compiler/compiler.h b/tinyusb/common/compiler/compiler.h index 0114063e4..6621b4160 100644 --- a/tinyusb/common/compiler/compiler.h +++ b/tinyusb/common/compiler/compiler.h @@ -38,8 +38,16 @@ #ifndef _TUSB_COMPILER_H_ #define _TUSB_COMPILER_H_ +#ifdef __cplusplus + extern "C" { +#endif + #if defined(__GNUC__) #include "compiler_gcc.h" #endif +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_COMPILER_H_ */ diff --git a/tinyusb/common/compiler/compiler_gcc.h b/tinyusb/common/compiler/compiler_gcc.h index e2671764f..38ef5f20f 100644 --- a/tinyusb/common/compiler/compiler_gcc.h +++ b/tinyusb/common/compiler/compiler_gcc.h @@ -35,6 +35,10 @@ * This file is part of the tiny usb stack. */ +#ifdef __cplusplus + extern "C" { +#endif + #ifndef _TUSB_COMPILER_GCC_H_ #define _TUSB_COMPILER_GCC_H_ @@ -52,4 +56,8 @@ #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline)) +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_COMPILER_GCC_H_ */ diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h index 0106fb988..e4a75f0e8 100644 --- a/tinyusb/common/errors.h +++ b/tinyusb/common/errors.h @@ -38,5 +38,13 @@ #ifndef _TUSB_ERRORS_H_ #define _TUSB_ERRORS_H_ +#ifdef __cplusplus + extern "C" { +#endif + + +#ifdef __cplusplus + } +#endif #endif /* _TUSB_ERRORS_H_ */ diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h index 52c92ad5f..fbcae447a 100644 --- a/tinyusb/device/dcd.h +++ b/tinyusb/device/dcd.h @@ -38,10 +38,18 @@ #ifndef _TUSB_DCD_H_ #define _TUSB_DCD_H_ +#ifdef __cplusplus + extern "C" { +#endif + #include "tusb_cfg.h" #ifdef DEVICE_ROMDRIVER #include "romdriver/mw_usbd_rom_api.h" #endif +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_DCD_H_ */ diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h index b7407e0d6..a9932af08 100644 --- a/tinyusb/host/hcd.h +++ b/tinyusb/host/hcd.h @@ -35,3 +35,15 @@ * This file is part of the tiny usb stack. */ +#ifndef _TUSB_HCD_H_ +#define _TUSB_HCD_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef __cplusplus + } +#endif + + #endif /* _TUSB_HCD_H_ */ diff --git a/tinyusb/tusb.h b/tinyusb/tusb.h index 7e5f2beb5..2c219e58d 100644 --- a/tinyusb/tusb.h +++ b/tinyusb/tusb.h @@ -35,8 +35,12 @@ * This file is part of the tiny usb stack. */ -#ifndef TUSB_H_ -#define TUSB_H_ +#ifndef _TUSB_H_ +#define _TUSB_H_ + +#ifdef __cplusplus + extern "C" { +#endif #include "common/common.h" #include "tusb_cfg.h" @@ -45,4 +49,8 @@ #include "device/dcd.h" #endif -#endif /* TUSB_H_ */ +#ifdef __cplusplus + } +#endif + +#endif /* _TUSB_H_ */ diff --git a/tinyusb/tusb_cfg.h b/tinyusb/tusb_cfg.h index b2b631977..3d876b86f 100644 --- a/tinyusb/tusb_cfg.h +++ b/tinyusb/tusb_cfg.h @@ -38,6 +38,10 @@ #ifndef _TUSB_CFG_H_ #define _TUSB_CFG_H_ +#ifdef __cplusplus + extern "C" { +#endif + #include "common/common.h" #define CFG_TUSB_HOST @@ -66,4 +70,8 @@ #define CDC_NOTIFICATION_EP_MAXPACKETSIZE 8 #define CDC_DATA_EP_MAXPACKET_SIZE 16 +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_CFG_H_ */