Skip to content

Commit

Permalink
drivers: add usbdev_mock
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrolanzieri committed Sep 4, 2020
1 parent 847c2f8 commit 16b5fd3
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,11 @@ endif

ifneq (,$(filter usbus,$(USEMODULE)))
DEFAULT_MODULE += auto_init_usbus
FEATURES_REQUIRED += periph_usbdev
USEMODULE += core_thread_flags
USEMODULE += event
ifeq (,$(filter usbdev_mock,$(USEMODULE)))
FEATURES_REQUIRED += periph_usbdev
endif
endif

ifneq (,$(filter usbus_cdc_acm,$(USEMODULE)))
Expand Down
7 changes: 3 additions & 4 deletions tests/usbus/usbdev_mock.h → drivers/include/usbdev_mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
* directory for more details.
*/
/**
* @defgroup tests_usbdev_mock USBdev mockup device
* @ingroup tests
* @defgroup drivers_usbdev_mock USBdev mockup device
* @ingroup drivers
* @brief USBdev mockup device for testing
* @{
*
* @file
*
* @author Koen Zandberg <koen@bergzand.net>
*/

Expand Down Expand Up @@ -115,3 +113,4 @@ void usbdev_mock_setup(usbdev_mock_esr_cb_t esr_cb,

#endif /* USBDEV_MOCK_H */
/** @} */
/** @} */
1 change: 1 addition & 0 deletions drivers/usbdev_mock/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(RIOTBASE)/Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <stdio.h>
#include <string.h>

#include "embUnit.h"
#include "periph/usbdev.h"
#include "test_utils/expect.h"
#include "usbdev_mock.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/usbus/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include ../Makefile.tests_common
USEMODULE += embunit
USEMODULE += usbus
FEATURES_PROVIDED += periph_usbdev
USEMODULE += usbdev_mock

DISABLE_MODULE += auto_init_usbus

Expand Down
2 changes: 2 additions & 0 deletions tests/usbus/Makefile.ci
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
BOARD_INSUFFICIENT_MEMORY := \
arduino-duemilanove \
arduino-leonardo \
arduino-nano \
arduino-uno \
atmega328p \
nucleo-f031k6 \
stm32f030f4-demo \
#
2 changes: 1 addition & 1 deletion tests/usbus/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static void _handle_data(usbdev_mock_t *dev, usbdev_mock_ep_t *ep, size_t len)

static void _ep_esr_validation(usbdev_mock_t *dev, usbdev_mock_ep_t *ep)
{
DEBUG("[ep esr]: Data available for stack: %u\n", ep->available);
DEBUG("[ep esr]: Data available for stack: %u\n", (unsigned)ep->available);
if (req_phase == TEST_REQ_PHASE_IDLE) {
DEBUG("[ep esr]: Done with the request\n");
/* signal USBDEV_EVENT_ESR to call _test_sequence */
Expand Down

0 comments on commit 16b5fd3

Please sign in to comment.