Skip to content

Commit c2519a8

Browse files
committed
TEST: add USBDevice library to core
1 parent 4f0dc1b commit c2519a8

File tree

16 files changed

+429
-5
lines changed

16 files changed

+429
-5
lines changed

cores/arduino/mbed/features/unsupported/USBDevice/USBAudio/USBAudio.h

+3
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
* }
6767
* @endcode
6868
*/
69+
namespace mbed {
70+
6971
class USBAudio: public USBDevice {
7072
public:
7173

@@ -385,4 +387,5 @@ class USBAudio: public USBDevice {
385387

386388
};
387389

390+
}
388391
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBDevice/USBDevice.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include "USBDevice_Types.h"
2424
#include "USBHAL.h"
2525

26+
namespace mbed {
27+
2628
class USBDevice: public USBHAL
2729
{
2830
public:
@@ -268,5 +270,5 @@ class USBDevice: public USBHAL
268270
uint8_t currentAlternate;
269271
};
270272

271-
273+
}
272274
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBDevice/USBHAL.h

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
//#define __packed __attribute__ ((__packed__))
2828
//#endif
2929

30+
namespace mbed {
31+
3032
class USBHAL {
3133
public:
3234
/* Configuration */
@@ -140,4 +142,6 @@ class USBHAL {
140142

141143

142144
};
145+
146+
}
143147
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBHID/USBHID.h

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
* @endcode
4848
*/
4949

50+
namespace mbed {
51+
5052
class USBHID: public USBDevice {
5153
public:
5254

@@ -171,4 +173,5 @@ class USBHID: public USBDevice {
171173
uint8_t input_length;
172174
};
173175

176+
}
174177
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBHID/USBKeyboard.h

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ enum FUNCTION_KEY {
9494
*
9595
* @endcode
9696
*/
97+
98+
namespace mbed {
99+
97100
class USBKeyboard: public USBHID, public Stream {
98101
public:
99102

@@ -186,4 +189,5 @@ class USBKeyboard: public USBHID, public Stream {
186189

187190
};
188191

192+
}
189193
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBHID/USBMouse.h

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ enum MOUSE_TYPE
104104
*
105105
* @endcode
106106
*/
107+
108+
namespace mbed {
109+
107110
class USBMouse: public USBHID
108111
{
109112
public:
@@ -207,4 +210,5 @@ class USBMouse: public USBHID
207210
bool mouseSend(int8_t x, int8_t y, uint8_t buttons, int8_t z);
208211
};
209212

213+
}
210214
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBHID/USBMouseKeyboard.h

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
* }
6868
* @endcode
6969
*/
70+
71+
namespace mbed {
72+
7073
class USBMouseKeyboard: public USBHID, public Stream
7174
{
7275
public:
@@ -217,4 +220,5 @@ class USBMouseKeyboard: public USBHID, public Stream
217220
virtual int _getc() { return -1;}
218221
};
219222

223+
}
220224
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBMIDI/USBMIDI.h

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
* }
5151
* @endcode
5252
*/
53+
54+
namespace mbed {
55+
5356
class USBMIDI: public USBDevice {
5457
public:
5558

@@ -109,4 +112,5 @@ class USBMIDI: public USBDevice {
109112
void (*midi_evt)(MIDIMessage);
110113
};
111114

115+
}
112116
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBMSD/USBMSD.h

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
* If disk_status() returns 1 (disk not initialized), then disk_initialize() is called. After this step, connect() will collect information
5656
* such as the number of blocks and the memory size.
5757
*/
58+
59+
namespace mbed {
60+
5861
class USBMSD: public USBDevice {
5962
public:
6063

@@ -248,4 +251,5 @@ class USBMSD: public USBDevice {
248251
void fail();
249252
};
250253

254+
}
251255
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBSerial/USBCDC.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
#include "USBDevice.h"
2828

29+
namespace mbed {
30+
2931
class USBCDC: public USBDevice {
3032
public:
3133

@@ -130,5 +132,5 @@ class USBCDC: public USBDevice {
130132
volatile bool terminal_connected;
131133

132134
};
133-
135+
}
134136
#endif

cores/arduino/mbed/features/unsupported/USBDevice/USBSerial/USBSerial.h

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
* }
4545
* @endcode
4646
*/
47+
namespace mbed {
48+
4749
class USBSerial: public USBCDC, public Stream {
4850
public:
4951

@@ -174,4 +176,5 @@ class USBSerial: public USBCDC, public Stream {
174176
void (*settingsChangedCallback)(int baud, int bits, int parity, int stop);
175177
};
176178

179+
}
177180
#endif

mbed-os-to-arduino

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ mbed toolchain GCC_ARM
88
echo -e "#include \"mbed.h\"\nint main() {Thread thd;}" > main.cpp
99
echo -e "{\n\"macros\": [\n\"MBED_HEAP_STATS_ENABLED=1\",\n\"MBED_STACK_STATS_ENABLED=1\",\n\"MBED_MEM_TRACING_ENABLED=1\"\n],\n\"target_overrides\": {\n \"*\": {\n\"platform.stdio-buffered-serial\": true,\n\"platform.stdio-baud-rate\": 115200,\n\"platform.default-serial-baud-rate\": 115200\n}\n}\n}\n" > mbed_app.json
1010

11-
mbed compile -v | grep "Macros:" > $BOARDNAME.macros.txt
11+
mbed compile -v --source . --source ./mbed-os/features/unsupported/USBDevice | grep "Macros:" > $BOARDNAME.macros.txt
1212
cat $BOARDNAME.macros.txt | cut -f2 -d":" > $ARDUINOCORE/defines.txt
1313
echo " -DMBED_NO_GLOBAL_USING_DIRECTIVE=1" >> $ARDUINOCORE/defines.txt
1414
xargs -n 1 < ./BUILD/$BOARDNAME/GCC_ARM/.include* | sed -e 's#./mbed-os#{build.core.path}/mbed#g' | sed -e 's#-I/.*$##' | tac > $ARDUINOCORE/includes.txt
15+
cat $ARDUINOCORE/includes.txt | sed -e 's#mbed-os#{build.core.path}/mbed#g' > $ARDUINOCORE/includes.txt
16+
17+
#TODO: remove -I{build.core.path}/mbed/drivers from includes.txt (name clashing with libraries)
18+
1519

1620
#TODO: remove -MDD from flags
1721

@@ -23,7 +27,7 @@ xargs -n 1 < ./BUILD/$BOARDNAME/GCC_ARM/.include* | sed -e 's#./mbed-os#{build.c
2327

2428
arm-none-eabi-ar rcs BUILD/mbed-core-$BOARDNAME.a `xargs -n 1 < ./BUILD/$BOARDNAME/GCC_ARM/.link_options.txt | grep "\.o" | grep -v "main.o"`
2529
cp BUILD/mbed-core-$BOARDNAME.a $ARDUINOCORE/libs/libmbed.a
26-
cd mbed-os && find . | grep "\.h" | xargs -I % cp --parents % $ARDUINOCORE/../../cores/arduino/mbed
30+
cd mbed-os && find . | grep "\.h" | xargs -I % cp --parents % $ARDUINOCORE/../../cores/arduino/mbed && cd ..
2731
cp ./BUILD/$BOARDNAME/GCC_ARM/.link_script.ld $ARDUINOCORE/linker_script.ld
2832
cp ./BUILD/$BOARDNAME/GCC_ARM/mbed_config.h $ARDUINOCORE/
2933

0 commit comments

Comments
 (0)