Skip to content

Commit ae4bd01

Browse files
committed
Redirect _write to Serial.
Former-commit-id: 724eab0
1 parent 3e0735a commit ae4bd01

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cores/nRF5/libc/printf/putchar.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
#include "Arduino.h"
22
#include "printf.h"
33

4-
extern "C" void _putchar(const char c)
4+
extern "C"
5+
{
6+
7+
void _putchar(const char c)
58
{
69
if(c == '\n') {
710
Serial.write('\r');
811
}
912
Serial.write(c);
1013
}
14+
15+
int _write (int fd, const void *buf, size_t count)
16+
{
17+
(void) fd;
18+
return (int)Serial.write((const uint8_t*)buf, count);
19+
}
20+
21+
} //extern "C"

0 commit comments

Comments
 (0)