File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,15 @@ UART::operator bool() {
203
203
return _serial != NULL && _serial->obj != NULL ;
204
204
}
205
205
206
+ UART::operator mbed::FileHandle*() {
207
+ #if defined(SERIAL_CDC)
208
+ if (is_usb) {
209
+ return &SerialUSB;
210
+ }
211
+ #endif
212
+ }
213
+
214
+
206
215
#if defined(SERIAL_CDC)
207
216
uint32_t UART::baud () {
208
217
if (is_usb) {
Original file line number Diff line number Diff line change 24
24
#include " Arduino.h"
25
25
#include " api/HardwareSerial.h"
26
26
#include " PinNames.h"
27
+ #include < platform/FileHandle.h>
27
28
28
29
#ifdef __cplusplus
29
30
@@ -52,6 +53,7 @@ class UART : public HardwareSerial {
52
53
size_t write (const uint8_t *, size_t );
53
54
using Print::write; // pull in write(str) and write(buf, size) from Print
54
55
operator bool ();
56
+ operator mbed::FileHandle*(); // exposes the internal mbed object
55
57
56
58
#if defined(SERIAL_CDC)
57
59
uint32_t baud ();
Original file line number Diff line number Diff line change 25
25
26
26
#include <Arduino.h>
27
27
#include <PinNames.h>
28
+ #include <platform/FileHandle.h>
28
29
29
30
// this is needed for backwards compatibility
30
31
#define digitalPinToInterrupt (P ) (P)
39
40
40
41
#define REDIRECT_STDOUT_TO (stream ) namespace mbed { \
41
42
FileHandle *mbed_override_console(int fd) { \
42
- return & stream; \
43
+ return static_cast<mbed::FileHandle*>( stream) ; \
43
44
} \
44
45
FileHandle *mbed_target_override_console(int fd) { \
45
- return & stream; \
46
+ return static_cast<mbed::FileHandle*>( stream) ; \
46
47
} \
47
48
}
You can’t perform that action at this time.
0 commit comments