Skip to content

Commit 258e7db

Browse files
committed
Fixed comment.
Moved constexpr.
1 parent d135b73 commit 258e7db

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

libraries/Wire/examples/master_writer_custombuffer/master_writer_custombuffer.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
// The following text will not fit into the default buffer of 32 bytes.
1717
static const char text[] = "You really won't believe it, but x is ";
1818

19-
size_t constexpr RECEIVE_BUFFER_SIZE = 0; // There is no receive in this sketch.
20-
size_t constexpr TRANSMIT_BUFFER_SIZE = 42; // Enhance the buffer to 42 characters.
19+
constexpr size_t RECEIVE_BUFFER_SIZE = 0; // There is no receive in this sketch.
20+
constexpr size_t TRANSMIT_BUFFER_SIZE = 42; // Enhance the buffer to 42 characters.
2121

2222
SET_WIRE_BUFFERS(RECEIVE_BUFFER_SIZE, TRANSMIT_BUFFER_SIZE,
2323
true /* master buffers needed */, false /* no slave buffers needed */ );
@@ -34,8 +34,8 @@ static byte x = 0;
3434

3535
void loop() {
3636
Wire.beginTransmission(8); // transmit to device #8
37-
Wire.write(text); // sends five bytes
38-
Wire.write(x); // sends one byte
37+
Wire.write(text); // sends multiple bytes
38+
Wire.write(x); // sends one byte
3939
Wire.endTransmission(); // stop transmitting
4040

4141
x++;

libraries/Wire/examples/slave_receiver_custombuffer/slave_receiver_custombuffer.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include <TwoWireBuffers.h>
1414
#include "Arduino.h"
1515

16-
size_t constexpr RECEIVE_BUFFER_SIZE = 42; // Be able receive up to 42 characters in one message.
17-
size_t constexpr TRANSMIT_BUFFER_SIZE = 0; // There is no transmit in this sketch.
16+
constexpr size_t RECEIVE_BUFFER_SIZE = 42; // Be able receive up to 42 characters in one message.
17+
constexpr size_t TRANSMIT_BUFFER_SIZE = 0; // There is no transmit in this sketch.
1818

1919
SET_WIRE_BUFFERS(RECEIVE_BUFFER_SIZE, TRANSMIT_BUFFER_SIZE,
2020
true /* master buffers needed */, false /* no slave buffers needed */ );
@@ -36,10 +36,10 @@ void loop() {
3636
// this function is registered as an event, see setup()
3737
void receiveEvent(int howMany) {
3838
while (1 < Wire.available()) { // loop through all but the last
39-
char c = Wire.read(); // receive byte as a character
39+
const char c = Wire.read(); // receive byte as a character
4040
Serial.print(c); // print the character
4141
}
42-
int x = Wire.read(); // receive byte as an integer
42+
const int x = Wire.read(); // receive byte as an integer
4343
Serial.println(x); // print the integer
4444
}
4545

libraries/Wire/examples/slave_sender_custombuffer/slave_sender_custombuffer.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
static const char text[] = "hello "; // respond with message of 6 bytes
1717

18-
size_t constexpr RECEIVE_BUFFER_SIZE = 0; // There is no receive in this sketch.
19-
size_t constexpr TRANSMIT_BUFFER_SIZE = sizeof(text)-1; // Don't need a byte for the \0
18+
constexpr size_t RECEIVE_BUFFER_SIZE = 0; // There is no receive in this sketch.
19+
constexpr size_t TRANSMIT_BUFFER_SIZE = sizeof(text)-1; // Don't need a byte for the \0
2020

2121
SET_WIRE_BUFFERS(RECEIVE_BUFFER_SIZE, TRANSMIT_BUFFER_SIZE,
2222
true /* master buffers needed */, false /* no slave buffers needed */ );

0 commit comments

Comments
 (0)