printer fixes and improvements
This commit is contained in:
parent
5482b71b3c
commit
e2e6ec28c0
@ -1,8 +1,8 @@
|
||||
#include <framework/globalfunctions/printer.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
void printer::print(uint8_t *data, size_t size, OutputType type, bool printInfo,
|
||||
size_t maxCharPerLine) {
|
||||
void printer::print(const uint8_t *data, size_t size, OutputType type,
|
||||
bool printInfo, size_t maxCharPerLine) {
|
||||
if(printInfo) {
|
||||
sif::info << "Printing data with size " << size << ": ";
|
||||
}
|
||||
@ -15,7 +15,8 @@ void printer::print(uint8_t *data, size_t size, OutputType type, bool printInfo,
|
||||
}
|
||||
}
|
||||
|
||||
void printer::printHex(uint8_t *data, size_t size, size_t maxCharPerLine) {
|
||||
void printer::printHex(const uint8_t *data, size_t size,
|
||||
size_t maxCharPerLine) {
|
||||
sif::info << std::hex;
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
sif::info << "0x" << static_cast<int>(data[i]);
|
||||
@ -31,10 +32,11 @@ void printer::printHex(uint8_t *data, size_t size, size_t maxCharPerLine) {
|
||||
sif::info << "]" << std::endl;
|
||||
}
|
||||
|
||||
void printer::printDec(uint8_t *data, size_t size, size_t maxCharPerLine) {
|
||||
void printer::printDec(const uint8_t *data, size_t size,
|
||||
size_t maxCharPerLine) {
|
||||
sif::info << std::dec;
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
sif::info << "0x" << static_cast<int>(data[i]);
|
||||
sif::info << static_cast<int>(data[i]);
|
||||
if(i < size - 1){
|
||||
sif::info << " , ";
|
||||
if(i > 0 and i % maxCharPerLine == 0) {
|
||||
|
@ -10,10 +10,10 @@ enum class OutputType {
|
||||
HEX
|
||||
};
|
||||
|
||||
void print(uint8_t* data, size_t size, OutputType type = OutputType::HEX,
|
||||
void print(const uint8_t* data, size_t size, OutputType type = OutputType::HEX,
|
||||
bool printInfo = true, size_t maxCharPerLine = 12);
|
||||
void printHex(uint8_t* data, size_t size, size_t maxCharPerLine = 12);
|
||||
void printDec(uint8_t* data, size_t size, size_t maxCharPerLine = 12);
|
||||
void printHex(const uint8_t* data, size_t size, size_t maxCharPerLine = 12);
|
||||
void printDec(const uint8_t* data, size_t size, size_t maxCharPerLine = 12);
|
||||
}
|
||||
|
||||
#endif /* FRAMEWORK_GLOBALFUNCTIONS_PRINTER_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user