Browse Source

Followup to #9141

pull/1/head
Scott Lahteine 7 years ago
parent
commit
742cff5f3c
  1. 24
      Marlin/src/HAL/HAL_LPC1768/HardwareSerial.h
  2. 24
      Marlin/src/HAL/HAL_LPC1768/serial.h

24
Marlin/src/HAL/HAL_LPC1768/HardwareSerial.h

@ -92,38 +92,38 @@ public:
void print(const char value[]) {
printf("%s" , value);
}
void print(char value, int nbase = BYTE) {
void print(char value, int nbase = 0) {
if (nbase == BIN) print_bin(value,8);
else if (nbase == OCT) printf("%3o", value);
else if (nbase == HEX) printf("%2X", value);
else if (nbase == DEC ) printf("%d", value);
else printf("%c" , value);
}
void print(unsigned char value, int nbase = BYTE) {
void print(unsigned char value, int nbase = 0) {
if (nbase == BIN) print_bin(value,8);
else if (nbase == OCT) printf("%3o", value);
else if (nbase == HEX) printf("%2X", value);
else printf("%u" , value);
}
void print(int value, int nbase = BYTE) {
void print(int value, int nbase = 0) {
if (nbase == BIN) print_bin(value,16);
else if (nbase == OCT) printf("%6o", value);
else if (nbase == HEX) printf("%4X", value);
else printf("%d", value);
}
void print(unsigned int value, int nbase = BYTE) {
void print(unsigned int value, int nbase = 0) {
if (nbase == BIN) print_bin(value,16);
else if (nbase == OCT) printf("%6o", value);
else if (nbase == HEX) printf("%4X", value);
else printf("%u" , value);
}
void print(long value, int nbase = BYTE) {
void print(long value, int nbase = 0) {
if (nbase == BIN) print_bin(value,32);
else if (nbase == OCT) printf("%11o", value);
else if (nbase == HEX) printf("%8X", value);
else printf("%ld" , value);
}
void print(unsigned long value, int nbase = BYTE) {
void print(unsigned long value, int nbase = 0) {
if (nbase == BIN) print_bin(value,32);
else if (nbase == OCT) printf("%11o", value);
else if (nbase == HEX) printf("%8X", value);
@ -141,27 +141,27 @@ public:
void println(const char value[]) {
printf("%s\n" , value);
}
void println(char value, int nbase = BYTE) {
void println(char value, int nbase = 0) {
print(value, nbase);
println();
}
void println(unsigned char value, int nbase = BYTE) {
void println(unsigned char value, int nbase = 0) {
print(value, nbase);
println();
}
void println(int value, int nbase = BYTE) {
void println(int value, int nbase = 0) {
print(value, nbase);
println();
}
void println(unsigned int value, int nbase = BYTE) {
void println(unsigned int value, int nbase = 0) {
print(value, nbase);
println();
}
void println(long value, int nbase = BYTE) {
void println(long value, int nbase = 0) {
print(value, nbase);
println();
}
void println(unsigned long value, int nbase = BYTE) {
void println(unsigned long value, int nbase = 0) {
print(value, nbase);
println();
}

24
Marlin/src/HAL/HAL_LPC1768/serial.h

@ -142,38 +142,38 @@ public:
}
void print(const char value[]) { printf("%s" , value); }
void print(char value, int nbase = BYTE) {
void print(char value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 8);
else if (nbase == OCT) printf("%3o", value);
else if (nbase == HEX) printf("%2X", value);
else if (nbase == DEC ) printf("%d", value);
else printf("%c" , value);
}
void print(unsigned char value, int nbase = BYTE) {
void print(unsigned char value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 8);
else if (nbase == OCT) printf("%3o", value);
else if (nbase == HEX) printf("%2X", value);
else printf("%u" , value);
}
void print(int value, int nbase = BYTE) {
void print(int value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 16);
else if (nbase == OCT) printf("%6o", value);
else if (nbase == HEX) printf("%4X", value);
else printf("%d", value);
}
void print(unsigned int value, int nbase = BYTE) {
void print(unsigned int value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 16);
else if (nbase == OCT) printf("%6o", value);
else if (nbase == HEX) printf("%4X", value);
else printf("%u" , value);
}
void print(long value, int nbase = BYTE) {
void print(long value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 32);
else if (nbase == OCT) printf("%11o", value);
else if (nbase == HEX) printf("%8X", value);
else printf("%ld" , value);
}
void print(unsigned long value, int nbase = BYTE) {
void print(unsigned long value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 32);
else if (nbase == OCT) printf("%11o", value);
else if (nbase == HEX) printf("%8X", value);
@ -183,12 +183,12 @@ public:
void print(double value, int round = 6) { printf("%f" , value); }
void println(const char value[]) { printf("%s\n" , value); }
void println(char value, int nbase = BYTE) { print(value, nbase); println(); }
void println(unsigned char value, int nbase = BYTE) { print(value, nbase); println(); }
void println(int value, int nbase = BYTE) { print(value, nbase); println(); }
void println(unsigned int value, int nbase = BYTE) { print(value, nbase); println(); }
void println(long value, int nbase = BYTE) { print(value, nbase); println(); }
void println(unsigned long value, int nbase = BYTE) { print(value, nbase); println(); }
void println(char value, int nbase = 0) { print(value, nbase); println(); }
void println(unsigned char value, int nbase = 0) { print(value, nbase); println(); }
void println(int value, int nbase = 0) { print(value, nbase); println(); }
void println(unsigned int value, int nbase = 0) { print(value, nbase); println(); }
void println(long value, int nbase = 0) { print(value, nbase); println(); }
void println(unsigned long value, int nbase = 0) { print(value, nbase); println(); }
void println(float value, int round = 6) { printf("%f\n" , value); }
void println(double value, int round = 6) { printf("%f\n" , value); }
void println(void) { print('\n'); }

Loading…
Cancel
Save