forked from ArduPilot/ardupilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AP_HAL: eliminate AP_HAL::Print and AP_HAL::Stream
Just *way* too many layers involved here
- Loading branch information
1 parent
b54ac27
commit 6c7c916
Showing
14 changed files
with
67 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "BetterStream.h" | ||
|
||
#include "print_vprintf.h" | ||
|
||
void AP_HAL::BetterStream::printf(const char *fmt, ...) | ||
{ | ||
va_list ap; | ||
va_start(ap, fmt); | ||
vprintf(fmt, ap); | ||
va_end(ap); | ||
} | ||
|
||
void AP_HAL::BetterStream::vprintf(const char *fmt, va_list ap) | ||
{ | ||
print_vprintf(this, fmt, ap); | ||
} | ||
|
||
size_t AP_HAL::BetterStream::write(const uint8_t *buffer, size_t size) | ||
{ | ||
for (size_t i=0; i<size;i++) { | ||
if (write(buffer[i] == 0)) { | ||
return i; | ||
} | ||
}; | ||
return size; | ||
} | ||
|
||
size_t AP_HAL::BetterStream::write(const char *str) | ||
{ | ||
return write((const uint8_t *)str, strlen(str)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.