  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
- /*
-  * This example displays 32x32 GIF animations loaded from a SD Card connected to the Teensy 3.1
-  * The GIFs can be up to 32 pixels in width and height.
-  * This code has been tested with 32x32 pixel and 16x16 pixel GIFs, but is optimized for 32x32 pixel GIFs.
-  *
-  * Wiring is on the default Teensy 3.1 SPI pins, and chip select can be on any GPIO,
-  * set by defining SD_CS in the code below
-  * Function     | Pin
-  * DOUT         |  11
-  * DIN          |  12
-  * CLK          |  13
-  * CS (default) |  15
-  *
-  * This code first looks for .gif files in the /gifs/ directory
-  * (customize below with the GIF_DIRECTORY definition) then plays random GIFs in the directory,
-  * looping each GIF for DISPLAY_TIME_SECONDS
-  *
-  * This example is meant to give you an idea of how to add GIF playback to your own sketch.
-  * For a project that adds GIF playback with other features, take a look at
-  * Light Appliance and Aurora:
-  * https://github.com/CraigLindley/LightAppliance
-  * https://github.com/pixelmatix/aurora
-  *
-  * If you find any GIFs that won't play properly, please attach them to a new
-  * Issue post in the GitHub repo here:
-  * https://github.com/pixelmatix/AnimatedGIFs/issues
-  */
+/*
+ * This example displays 32x32 GIF animations loaded from a SD Card connected to the Teensy 3.1
+ * The GIFs can be up to 32 pixels in width and height.
+ * This code has been tested with 32x32 pixel and 16x16 pixel GIFs, but is optimized for 32x32 pixel GIFs.
+ *
+ * Wiring is on the default Teensy 3.1 SPI pins, and chip select can be on any GPIO,
+ * set by defining SD_CS in the code below
+ * Function     | Pin
+ * DOUT         |  11
+ * DIN          |  12
+ * CLK          |  13
+ * CS (default) |  15
+ *
+ * This code first looks for .gif files in the /gifs/ directory
+ * (customize below with the GIF_DIRECTORY definition) then plays random GIFs in the directory,
+ * looping each GIF for DISPLAY_TIME_SECONDS
+ *
+ * This example is meant to give you an idea of how to add GIF playback to your own sketch.
+ * For a project that adds GIF playback with other features, take a look at
+ * Light Appliance and Aurora:
+ * https://github.com/CraigLindley/LightAppliance
+ * https://github.com/pixelmatix/aurora
+ *
+ * If you find any GIFs that won't play properly, please attach them to a new
+ * Issue post in the GitHub repo here:
+ * https://github.com/pixelmatix/AnimatedGIFs/issues
+ */
+
+/*
+ * CONFIGURATION:
+ *  - update the "SmartMatrix configuration and memory allocation" section to match the width and height and other configuration of your display
+ *  - Note for 128x32 and 64x64 displays - need to reduce RAM:
+ *    set kRefreshDepth=24 and kDmaBufferRows=2 or set USB Type: "None" in Arduino,
+ *    decrease refreshRate in setup() to 90 or lower to get good an accurate GIF frame rate
+ *  - WIDTH and HEIGHT are defined in GIFParseFunctions.cpp, update to match the size of your GIFs
+ *    only play GIFs that are size WIDTHxHEIGHT or smaller
+ */
 
 #include <SmartMatrix3.h>
 #include <SPI.h>


    matrix.begin();

    // for large panels, set the refresh lower to give more CPU time to decoding GIFs
    //matrix.setRefreshRate(90);

    // Clear screen
    backgroundLayer.fillScreen(COLOR_BLACK);

const rgb24 COLOR_BLACK = {
    0, 0, 0 };


/* SmartMatrix configuration and memory allocation */
#define COLOR_DEPTH 24                  // known working: 24, 48 - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24
