// Program to exercise the MD_Parola library
//
// Demonstrates minimum required for sprite animated text.
//
// MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX
//

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 8

#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10

// HARDWARE SPI
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// SOFTWARE SPI
//MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

// Global variables
const char msg[] = "Hi";

// Sprite Definition
const uint8_t F_ROCKET = 1;//2
const uint8_t W_ROCKET = 8;//11
/*
const uint8_t PROGMEM rocket[F_ROCKET * W_ROCKET] =  // rocket
{
  0x18, 0x24, 0x42, 0x81, 0x99, 0x18, 0x99, 0x18, 0xa5, 0x5a, 0x81,
  0x18, 0x24, 0x42, 0x81, 0x18, 0x99, 0x18, 0x99, 0x24, 0x42, 0x99,
//0x18, 0x24, 0x42, 0x81,-0x18, 0x99, 0x18, 0x99, 0x24, 0x42, 0x99,
//0x18, 0x99, 0x18, 0x99,-0x81,0x42,0x24,0x18,
// 5    6      7     8     4     3     2    1
//0x03, 0x03, 0x38, 0x44, 0x44, 0x44, 0x00, 0x00,
//0x00, 0x00, 0x44, 0x44, 0x03, 0x03, 0x38, 0x44
};
*/
const uint8_t custom[] = {60, 66, 133, 137, 145, 161, 66, 60};

void setup(void)
{
  P.begin();
  P.setSpeed(0, 100);
  P.displayText(msg, PA_CENTER, P.getSpeed(), 1000, PA_SPRITE, PA_SPRITE);
  P.setSpriteData(custom, W_ROCKET, F_ROCKET, custom, W_ROCKET, F_ROCKET);
}

void loop(void)
{
  if (P.displayAnimate())
    P.displayReset();
}


//void MD_Parola::setSpeed	(	uint8_t 	z,
//uint16_t 	speed 
//)