include: improve compatibility with C++ apps.
This patch lets a C++ application use more of Zephyr by adding guards and changeing some constructs to the C++11 equivalent. Changes include: - Adding guards - Switching to static_assert - Switching to a template for ARRAY_SIZE as g++ doesn't have the builtin. - Re-ordering designated initialisers to match the struct field order as G++ only supports simple designated initialisers. Signed-off-by: Michael Hope <mlhx@google.com>
This commit is contained in:
parent
835ee3fff0
commit
5f67a6119d
13 changed files with 135 additions and 59 deletions
|
@ -17,6 +17,10 @@
|
|||
#ifndef __USB_HID_H__
|
||||
#define __USB_HID_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct usb_hid_class_subdescriptor {
|
||||
u8_t bDescriptorType;
|
||||
u16_t wDescriptorLength;
|
||||
|
@ -153,4 +157,8 @@ void usb_hid_register_device(const u8_t *desc, size_t size,
|
|||
/* Initialize USB HID */
|
||||
int usb_hid_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USB_HID_H__ */
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
#include <drivers/usb/usb_dc.h>
|
||||
#include <usb/usbstruct.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* USB configuration
|
||||
**************************************************************************/
|
||||
|
@ -363,4 +367,8 @@ int usb_transfer_sync(u8_t ep, u8_t *data, size_t dlen, unsigned int flags);
|
|||
*/
|
||||
void usb_cancel_transfer(u8_t ep);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* USB_DEVICE_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue