Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adrian
firmware
Commits
a6d2a216
Verified
Commit
a6d2a216
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
fix(pycardium): Properly print line-endings for serial
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
3c4c5bd6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pycardium/mphalport.c
+15
-1
15 additions, 1 deletion
pycardium/mphalport.c
with
15 additions
and
1 deletion
pycardium/mphalport.c
+
15
−
1
View file @
a6d2a216
...
@@ -44,7 +44,21 @@ int DEBUG_printf(const char *fmt, ...)
...
@@ -44,7 +44,21 @@ int DEBUG_printf(const char *fmt, ...)
/* newlib syscall to allow printf to work */
/* newlib syscall to allow printf to work */
long
_write
(
int
fd
,
const
char
*
buf
,
size_t
cnt
)
long
_write
(
int
fd
,
const
char
*
buf
,
size_t
cnt
)
{
{
epic_uart_write_str
(
buf
,
cnt
);
/*
* Only print one line at a time. Insert `\r` between lines so
* they are properly displayed on the serial console.
*/
size_t
i
,
last
=
0
;
for
(
i
=
0
;
i
<
cnt
;
i
++
)
{
if
(
buf
[
i
]
==
'\n'
)
{
epic_uart_write_str
(
&
buf
[
last
],
i
-
last
);
epic_uart_write_str
(
"
\r
"
,
1
);
last
=
i
;
}
}
if
(
last
!=
i
)
{
epic_uart_write_str
(
&
buf
[
last
],
cnt
-
last
);
}
return
cnt
;
return
cnt
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment