forked from modm-io/modm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtusb_config.h.in
47 lines (38 loc) · 1.36 KB
/
tusb_config.h.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Copyright (c) 2020, 2023, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------
#pragma once
#include <modm/platform/device.hpp>
#if __has_include(<tusb_config_local.h>)
# include <tusb_config_local.h>
#endif
%% for name, value in config.items() | sort
#ifndef {{name}}
# define {{name}} {{value}}
#endif
%% endfor
%% if target.platform == "rp"
#if defined TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX && (TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX == 1)
# error TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX is not supported in modm currently.
#endif
%% endif
%#
#include <modm/architecture/interface/assert.h>
// Redirect TinyUSB asserts to use modm_assert
#define MODM_ASSERT_1ARGS(_cond) \
do { \
modm_assert(_cond, "tu", __FILE__ ":" MODM_STRINGIFY(__LINE__) " -> \"" #_cond "\""); \
} while(0)
#define MODM_ASSERT_2ARGS(_cond, _ret) \
do { \
if (!modm_assert_continue_fail(_cond, "tu", __FILE__ ":" MODM_STRINGIFY(__LINE__) " -> \"" #_cond "\"")) \
{ return _ret; } \
} while(0)
#define TU_ASSERT(...) TU_GET_3RD_ARG(__VA_ARGS__, MODM_ASSERT_2ARGS, MODM_ASSERT_1ARGS,UNUSED)(__VA_ARGS__)