/**
* Manages which pixels that should be lit to display current time.
* PixelOn(pixelIndex) returns true if the pixel shoult be on.
*/

#include "FastLED.h"
#include <RTClib.h>
#include <TimeLib.h>

#ifndef ClockDisplay_h
#define ClockDisplay_h

#define NUMPIXELS 58 // Number of LEDs in strip
#define PIXELSPERCHAR 14 // number of pixels per character (number)
#define PIXELSPERSEGMENT 2
#define COLONSTARTINDEX 28

class ClockDisplay {
public:
	ClockDisplay();
	~ClockDisplay();
	void ShowTime(time_t t);	
  boolean PixelOn(byte pixelIndex); // returns true if the pixel should be on
private:
	void ShowNumber(uint8_t number, uint16_t startPixel);
	void ShowSegment(uint16_t offset, byte segmentNo, boolean on);
	void ShowColon();	
  void Clear();
  boolean leds[NUMPIXELS];
	//const byte SIFFERARRAY[10] = {63,24,118,124,89,109,111,56,127,125};
  const byte NUMBERARRAY[10][7] = { // Defines which segments should be lit for each number 0..9
                                    {1,1,1,1,1,1,0}, // 0
                                    {0,0,1,1,0,0,0}, // 1
                                    {0,1,1,0,1,1,1}, // 2
                                    {0,1,1,1,1,0,1}, // 3
                                    {1,0,1,1,0,0,1}, // 4
                                    {1,1,0,1,1,0,1}, // 5
                                    {1,1,0,1,1,1,1}, // 6
                                    {0,1,1,1,0,0,0}, // 7
                                    {1,1,1,1,1,1,1}, // 8
                                    {1,1,1,1,1,0,1}  // 9 
  };
  byte colonOn = false;
};

#endif // ClockDisplay_h
