Skip to content

Commit 4563e4d

Browse files
committed
Whitespace fixes.
1 parent aea6ad6 commit 4563e4d

File tree

4 files changed

+30
-31
lines changed

4 files changed

+30
-31
lines changed

examples/PacketSerialReverseEcho/PacketSerialReverseEcho.ino

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// The PacketSerial object.
3030
// It cleverly wraps one of the Serial objects.
3131
// While it is still possible to use the Serial object
32-
// directly, it is recommended that the user let the
32+
// directly, it is recommended that the user let the
3333
// PacketSerial object manage all serial communication.
3434
// Thus the user should not call Serial.write(), etc.
3535
// Additionally the user should not use the serialEvent()
@@ -48,29 +48,29 @@ void setup()
4848
void loop()
4949
{
5050
// Do other things here.
51-
51+
5252
// The update() method attempts to read in
5353
// any incoming serial data and emits packets via
54-
// the user's onPacket(const uint8_t* buffer, size_t size)
55-
// method registered with the setPacketHandler() method.
54+
// the user's onPacket(const uint8_t* buffer, size_t size)
55+
// method registered with the setPacketHandler() method.
5656
//
5757
// The update() method should be called at the end of the loop().
58-
serial.update();
58+
serial.update();
5959
}
6060

6161
// This is our packet callback.
6262
// The buffer is delivered already decoded.
6363
void onPacket(const uint8_t* buffer, size_t size)
6464
{
6565
// Make a temporary buffer.
66-
uint8_t tmp[size];
67-
66+
uint8_t tmp[size];
67+
6868
// Copy the packet into our temporary buffer.
69-
memcpy(tmp, buffer, size);
70-
69+
memcpy(tmp, buffer, size);
70+
7171
// Reverse our temporaray buffer.
7272
reverse(tmp, size);
73-
73+
7474
// Send the reversed buffer back.
7575
// The send() method will encode the buffer
7676
// as a packet, set packet markers, etc.
@@ -81,7 +81,7 @@ void onPacket(const uint8_t* buffer, size_t size)
8181
void reverse(uint8_t* buffer, size_t size)
8282
{
8383
uint8_t tmp;
84-
84+
8585
for (int i=0; i < size / 2; i++)
8686
{
8787
tmp = buffer[i];

src/Encoding/COBS.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
/// \sa http://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing
5151
/// \sa https://github.com/jacquesf/COBS-Consistent-Overhead-Byte-Stuffing
5252
/// \sa http://www.jacquesf.com/2011/03/consistent-overhead-byte-stuffing/
53-
class COBS
53+
class COBS
5454
{
5555
public:
5656
/// \brief Encode a byte buffer with the COBS encoder.
@@ -67,9 +67,9 @@ class COBS
6767
size_t code_index = 0;
6868
uint8_t code = 1;
6969

70-
while(read_index < size)
70+
while (read_index < size)
7171
{
72-
if(source[read_index] == 0)
72+
if (source[read_index] == 0)
7373
{
7474
destination[code_index] = code;
7575
code = 1;
@@ -81,7 +81,7 @@ class COBS
8181
destination[write_index++] = source[read_index++];
8282
code++;
8383

84-
if(code == 0xFF)
84+
if (code == 0xFF)
8585
{
8686
destination[code_index] = code;
8787
code = 1;
@@ -108,28 +108,28 @@ class COBS
108108
uint8_t code;
109109
uint8_t i;
110110

111-
while(read_index < size)
111+
while (read_index < size)
112112
{
113113
code = source[read_index];
114114

115-
if(read_index + code > size && code != 1)
115+
if (read_index + code > size && code != 1)
116116
{
117117
return 0;
118118
}
119119

120120
read_index++;
121121

122-
for(i = 1; i < code; i++)
122+
for (i = 1; i < code; i++)
123123
{
124124
destination[write_index++] = source[read_index++];
125125
}
126126

127-
if(code != 0xFF && read_index != size)
127+
if (code != 0xFF && read_index != size)
128128
{
129129
destination[write_index++] = '\0';
130130
}
131131
}
132-
132+
133133
return write_index;
134134
}
135135

src/Encoding/SLIP.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "Arduino.h"
3737

3838

39-
4039
/// \brief A Serial Line IP (SLIP) Encoder.
4140
///
4241
/// Serial Line IP (SLIP) is a packet framing protocol: SLIP defines a

src/PacketSerial.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class PacketSerial_
4949

5050
void begin(unsigned long baud, size_t port = 0)
5151
{
52-
switch(port)
52+
switch(port)
5353
{
5454
#if defined(UBRR1H)
5555
case 1:
@@ -74,7 +74,7 @@ class PacketSerial_
7474
_serial = &Serial;
7575
}
7676
}
77-
77+
7878
void begin(Stream* serial)
7979
{
8080
_serial = serial;
@@ -90,12 +90,12 @@ class PacketSerial_
9090

9191
if (data == PacketMarker)
9292
{
93-
if (_onPacketFunction)
93+
if (_onPacketFunction)
9494
{
9595
uint8_t _decodeBuffer[_recieveBufferIndex];
9696

97-
size_t numDecoded = EncoderType::decode(_recieveBuffer,
98-
_recieveBufferIndex,
97+
size_t numDecoded = EncoderType::decode(_recieveBuffer,
98+
_recieveBufferIndex,
9999
_decodeBuffer);
100100

101101
_onPacketFunction(_decodeBuffer, numDecoded);
@@ -123,8 +123,8 @@ class PacketSerial_
123123

124124
uint8_t _encodeBuffer[EncoderType::getEncodedBufferSize(size)];
125125

126-
size_t numEncoded = EncoderType::encode(buffer,
127-
size,
126+
size_t numEncoded = EncoderType::encode(buffer,
127+
size,
128128
_encodeBuffer);
129129

130130
_serial->write(_encodeBuffer, numEncoded);
@@ -135,17 +135,17 @@ class PacketSerial_
135135
{
136136
_onPacketFunction = onPacketFunction;
137137
}
138-
138+
139139

140140
private:
141141
PacketSerial_(const PacketSerial_&);
142142
PacketSerial_& operator = (const PacketSerial_&);
143143

144144
uint8_t _recieveBuffer[BufferSize];
145145
size_t _recieveBufferIndex;
146-
146+
147147
Stream* _serial;
148-
148+
149149
PacketHandlerFunction _onPacketFunction;
150150

151151
};

0 commit comments

Comments
 (0)