From 5ba3293da2414b7495229775e214c4a1aa21d809 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Thu, 11 Aug 2022 11:10:31 +0100 Subject: [PATCH] usbd: Added an array length helper macro --- include/libopencm3/usb/usbd.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/libopencm3/usb/usbd.h b/include/libopencm3/usb/usbd.h index 0baa7efa..83df0300 100644 --- a/include/libopencm3/usb/usbd.h +++ b/include/libopencm3/usb/usbd.h @@ -42,6 +42,9 @@ LGPL License Terms @ref lgpl_license BEGIN_DECLS +#ifndef ARRAY_LENGTH +#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(*(array))) +#endif enum usbd_request_return_codes { USBD_REQ_NOTSUPP = 0,