Skip to content

Commit f65e690

Browse files
committed
Removed non standard functionality from Print class for BYTE "base" as this is available via e.g. Serial.write and conflicts with the FatFS library and potentially anything else defining BYTE
Fixed sketches using this behaviour
1 parent f8d28b8 commit f65e690

File tree

11 files changed

+13
-44
lines changed

11 files changed

+13
-44
lines changed

STM32F1/cores/maple/Print.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ size_t Print::print(unsigned long n, int base) {
9999
}
100100

101101
size_t Print::print(long long n, int base) {
102-
if (base == BYTE)
103-
{
104-
return write((uint8)n);
105-
}
106102
if (n < 0) {
107103
print('-');
108104
n = -n;
@@ -111,13 +107,7 @@ size_t Print::print(long long n, int base) {
111107
}
112108

113109
size_t Print::print(unsigned long long n, int base) {
114-
size_t c=0;
115-
if (base == BYTE) {
116-
c= write((uint8)n);
117-
} else {
118-
c= printNumber(n, base);
119-
}
120-
return c;
110+
return printNumber(n, base);
121111
}
122112

123113
size_t Print::print(double n, int digits) {

STM32F1/cores/maple/Print.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "Printable.h"
2929

3030
enum {
31-
BYTE = 0,
3231
BIN = 2,
3332
OCT = 8,
3433
DEC = 10,

STM32F1/libraries/A_STM32_Examples/examples/Communication/ASCIITable/ASCIITable.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void loop() {
4747
// Prints value unaltered, i.e. the raw binary version of the
4848
// byte. The serial monitor interprets all bytes as
4949
// ASCII, so 33, the first number, will show up as '!'
50-
Serial.print(thisByte, BYTE);
50+
Serial.write(thisByte);
5151

5252
Serial.print(", dec: ");
5353
// Prints value as string as an ASCII-encoded decimal (base 10).

STM32F1/libraries/A_STM32_Examples/examples/Communication/MIDI/Midi.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ void loop() {
4444
// Plays a MIDI note. Doesn't check to see that cmd is greater than
4545
// 127, or that data values are less than 127:
4646
void noteOn(int cmd, int pitch, int velocity) {
47-
Serial1.print(cmd, BYTE);
48-
Serial1.print(pitch, BYTE);
49-
Serial1.print(velocity, BYTE);
47+
Serial1.write(cmd);
48+
Serial1.write(pitch);
49+
Serial1.write(velocity);
5050
}
5151

STM32F1/libraries/A_STM32_Examples/examples/Communication/SerialCallResponse/SerialCallResponse.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ void loop() {
5050
// read switch, map it to 0 or 255
5151
thirdSensor = map(digitalRead(2), 0, 1, 0, 255);
5252
// send sensor values:
53-
Serial.print(firstSensor, BYTE);
54-
Serial.print(secondSensor, BYTE);
55-
Serial.print(thirdSensor, BYTE);
53+
Serial.write(firstSensor);
54+
Serial.write(secondSensor);
55+
Serial.write(thirdSensor);
5656
}
5757
}
5858

5959
void establishContact() {
6060
while (Serial.available() <= 0) {
61-
Serial.print('A', BYTE); // send a capital A
61+
Serial.write('A'); // send a capital A
6262
delay(300);
6363
}
6464
}

STM32F1/libraries/A_STM32_Examples/examples/Communication/SerialPassthrough/SerialPassthrough.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ void loop() {
2626
// Read from Serial1, send over USB on Maple (or uses hardware serial 1 and hardware serial 2 on non-maple boards:
2727
if (Serial1.available()) {
2828
inByte = Serial1.read();
29-
Serial.print(inByte, BYTE);
29+
Serial.write(inByte);
3030
}
3131
}

STM32F1/libraries/A_STM32_Examples/examples/General/USB_ASCII/USB_ASCII.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void loop() {
6767
// Prints value unaltered, i.e. the raw binary version of the
6868
// byte. The serial monitor interprets all bytes as
6969
// ASCII, so 33, the first number, will show up as '!'
70-
Serial.print(thisByte, BYTE);
70+
Serial.write(thisByte);
7171

7272
Serial.print(", dec: ");
7373
// Prints value as string as an ASCII-encoded decimal (base 10).

STM32F3/cores/maple/wirish/Print.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ void Print::print(unsigned long n, int base) {
8888
}
8989

9090
void Print::print(long long n, int base) {
91-
if (base == BYTE) {
92-
write((uint8)n);
93-
return;
94-
}
9591
if (n < 0) {
9692
print('-');
9793
n = -n;
@@ -100,11 +96,7 @@ void Print::print(long long n, int base) {
10096
}
10197

10298
void Print::print(unsigned long long n, int base) {
103-
if (base == BYTE) {
104-
write((uint8)n);
105-
} else {
106-
printNumber(n, base);
107-
}
99+
printNumber(n, base);
108100
}
109101

110102
void Print::print(double n, int digits) {

STM32F3/cores/maple/wirish/Print.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <libmaple/libmaple_types.h>
2727

2828
enum {
29-
BYTE = 0,
3029
BIN = 2,
3130
OCT = 8,
3231
DEC = 10,

STM32F4/cores/maple/Print.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ size_t Print::print(unsigned long n, int base) {
9999
}
100100

101101
size_t Print::print(long long n, int base) {
102-
if (base == BYTE)
103-
{
104-
return write((uint8)n);
105-
}
106102
if (n < 0) {
107103
print('-');
108104
n = -n;
@@ -111,13 +107,7 @@ size_t Print::print(long long n, int base) {
111107
}
112108

113109
size_t Print::print(unsigned long long n, int base) {
114-
size_t c=0;
115-
if (base == BYTE) {
116-
c= write((uint8)n);
117-
} else {
118-
c= printNumber(n, base);
119-
}
120-
return c;
110+
return printNumber(n, base);
121111
}
122112

123113
size_t Print::print(double n, int digits) {

0 commit comments

Comments
 (0)