#include <Arduino.h>
#include "LedDisplay.h"

#define MATRIX_PIN 4
#define TILE_PIXEL_ROWS 8
#define TILE_PIXEL_COLS 8
#define MATRIX_TILES_ROW 1
#define MATRIX_TILES_COL 6
#define MATRIX_PIXEL_WIDTH TILE_PIXEL_COLS*MATRIX_TILES_COL
#define MATRIX_PIXEL_HEIGHT TILE_PIXEL_ROWS*MATRIX_TILES_ROW

LedDisplay *display;

///----- Setup of display driver and topology: -------------------------------------------------------------------------
// For detailed information on NeoPixel and NeoTiles etc. - all around display topology setup please see here:
// https://github.com/Makuna/NeoPixelBus/wiki/Matrix-Panels-Support 
NeoPixelBrightnessBusGfx<NeoGrbFeature, Neo800KbpsMethod> *displayMatrix = new NeoPixelBrightnessBusGfx<NeoGrbFeature, Neo800KbpsMethod>(MATRIX_PIXEL_WIDTH, MATRIX_PIXEL_HEIGHT, MATRIX_PIN);
NeoTiles <RowMajorLayout, RowMajorLayout> tiles(TILE_PIXEL_COLS, TILE_PIXEL_ROWS, MATRIX_TILES_COL,MATRIX_TILES_ROW);
// use a remap function to remap based on the topology, tile or mosaik
// this function is passed as remap function to the matrix
uint16_t remap(uint16_t x, uint16_t y) {
  return tiles.Map(x, y);
}
///--------------------------------------------------------------------------------------------------------------------

void setup()
{
  Serial.begin(115200);
  Serial.printf("Los\n");
  // create our display
  displayMatrix->setRemapFunction(&remap);
  display = new LedDisplay("LedDisplay1", displayMatrix);
  
}

void loop()
{
  // nothing to do in loop
  //Serial.printf("LDR value is: %d\n", analogRead(LDR_PIN));
  display->loop();
  delay(1);
}
