<commit_before>/*
 * This demo shows how to display bitmaps that are exported from GIMP and
 * compiled into the sketch and stored in the Teensy's Flash memory
 * See more details here:
 * http://docs.pixelmatix.com/SmartMatrix/library.html#drawing-raw-bitmaps
 */

#include <SmartMatrix_32x32.h>

#include "gimpbitmap.h"

// pixelmatix.c is a bitmap exported from GIMP without modification
#include "pixelmatix.c"

// colorwheel.c has been modified to use the gimp32x32bitmap struct
#include "colorwheel.c"

// chrome16 is a 16x16 pixel bitmap, exported from GIMP without modification
#include "chrome16.c"

SmartMatrix matrix;

int led = 13;

void drawBitmap(int16_t x, int16_t y, const gimp32x32bitmap* bitmap) {
  for(int i=0; i<bitmap->height; i++) {
    for(int j=0; j<bitmap->width; j++) {
      rgb24 pixel = { bitmap->pixel_data[(i*bitmap->width + j)*3 + 0],
                      bitmap->pixel_data[(i*bitmap->width + j)*3 + 1],
                      bitmap->pixel_data[(i*bitmap->width + j)*3 + 2] };

      matrix.drawPixel(x + j, y + i, pixel);
    }
  }
}

void setup() {
  matrix.begin();
  matrix.setBrightness(128);

  pinMode(led, OUTPUT);
}

void loop() {
  int i;
  rgb24 *buffer;

  matrix.fillScreen({0,0,0});
  // to use drawBitmap, must cast the pointer to pixelmatixlogo as (const gimp32x32bitmap*)
  drawBitmap(0,0,(const gimp32x32bitmap*)&pixelmatixlogo);
  matrix.swapBuffers();

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);

  buffer = matrix.backBuffer();

  matrix.fillScreen({0,0,0});
  // can pass &colorwheel in directly as the bitmap source is already gimp32x32bitmap
  drawBitmap(0,0,&colorwheel);
  matrix.swapBuffers();

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);


  matrix.fillScreen({0,0,0});
  // draw this smaller bitmap centered
  int x = (MATRIX_WIDTH / 2) - (chrome16.width/2);
  int y = (MATRIX_HEIGHT / 2) - (chrome16.height/2);
  drawBitmap(x, y, (const gimp32x32bitmap*)&chrome16);
  matrix.swapBuffers();

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);
}
<commit_msg>Cleanup Bitmaps example removing warnings<commit_after>/*
 * This demo shows how to display bitmaps that are exported from GIMP and
 * compiled into the sketch and stored in the Teensy's Flash memory
 * See more details here:
 * http://docs.pixelmatix.com/SmartMatrix/library.html#drawing-raw-bitmaps
 */

#include <SmartMatrix_32x32.h>

#include "gimpbitmap.h"

// pixelmatix.c is a bitmap exported from GIMP without modification
#include "pixelmatix.c"

// colorwheel.c has been modified to use the gimp32x32bitmap struct
#include "colorwheel.c"

// chrome16 is a 16x16 pixel bitmap, exported from GIMP without modification
#include "chrome16.c"

SmartMatrix matrix;

int led = 13;

void drawBitmap(int16_t x, int16_t y, const gimp32x32bitmap* bitmap) {
  for(unsigned int i=0; i < bitmap->height; i++) {
    for(unsigned int j=0; j < bitmap->width; j++) {
      rgb24 pixel = { bitmap->pixel_data[(i*bitmap->width + j)*3 + 0],
                      bitmap->pixel_data[(i*bitmap->width + j)*3 + 1],
                      bitmap->pixel_data[(i*bitmap->width + j)*3 + 2] };

      matrix.drawPixel(x + j, y + i, pixel);
    }
  }
}

void setup() {
  matrix.begin();
  matrix.setBrightness(128);

  pinMode(led, OUTPUT);
}

void loop() {
  matrix.fillScreen({0,0,0});
  // to use drawBitmap, must cast the pointer to pixelmatixlogo as (const gimp32x32bitmap*)
  drawBitmap(0,0,(const gimp32x32bitmap*)&pixelmatixlogo);
  matrix.swapBuffers();

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);

  matrix.fillScreen({0,0,0});
  // can pass &colorwheel in directly as the bitmap source is already gimp32x32bitmap
  drawBitmap(0,0,&colorwheel);
  matrix.swapBuffers();

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);


  matrix.fillScreen({0,0,0});
  // draw this smaller bitmap centered
  int x = (MATRIX_WIDTH / 2) - (chrome16.width/2);
  int y = (MATRIX_HEIGHT / 2) - (chrome16.height/2);
  drawBitmap(x, y, (const gimp32x32bitmap*)&chrome16);
  matrix.swapBuffers();

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);
}

{'fraction_non_alphanumeric': 0.1288723667905824, 'fraction_numerical': 0.042544403139198675, 'mean_word_length': 3.5905213270142182, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2617547', 'n_tokens_mistral': 1764, 'n_tokens_neox': 1649, 'n_words': 490}