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()
4848void 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.
6363void 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)
8181void 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];
0 commit comments