#ifndef STRUCTURES_H
#define STRUCTURES_H

// The faux seven segment display has some degree of flexibility for size and position of the 
// segments, this header defines a number of values for ease of adjustment and speed of processing
// These values never change so are defined as constants rather than computed each loop

// Defines a value for the length of each of the segments
const uint8_t SEGL=9;

// A simple structure for XY coordinates
struct point {
  uint8_t x;
  uint8_t y;
};

// define the positions of four digits on the clock
const point digitPos[] = {{15, 35}, 
                          {45, 35},   
                          {85, 35}, 
                          {115, 35}};

// A simple structure to define each of the lines that make up a segment
struct segLin {
  uint8_t start;
  uint8_t length;
};

// The location of each segment with respect to the centre of the digit and
// an indicator to say if they are vertical or horizontal
struct segPos {
  uint8_t x;
  uint8_t y;
  bool vertical;
};

// An array of values to define which segments are lit to make the various characters
// This array has been extended to include the hexadecimal characters 
const uint8_t litSegments [] = {B00111111, //0
                                B00000110, //1
                                B01011011, //2
                                B01001111, //3
                                B01100110, //4
                                B01101101, //5
                                B01111101, //6
                                B00000111, //7
                                B01111111, //8
                                B01101111, //9

                                B01110111, //A
                                B01111100, //b
                                B00111001, //C
                                B01011110, //d
                                B01111001, //E
                                B01110001, //F
                                };

// Precalculate the lines in the segment to save processing them every time
const segLin segLengths[] = {{SEGL-2, (SEGL*2)-3},
                             {SEGL-1, (SEGL*2)-1},
                             {SEGL,   (SEGL*2)+1},
                             {SEGL-1, (SEGL*2)-1},
                             {SEGL-2, (SEGL*2)-3}};

// Precalculate the segment relative positions to save processing them every time
const segPos segments[] = {{0,       (SEGL*2)+4,   false},   //a
                           {-SEGL-1, SEGL+2,       true},    //b
                           {-SEGL-1, -SEGL-2,      true},    //c
                           {0,       -(SEGL*2)-4,  false},   //d
                           {SEGL+1,  -SEGL-2,      true},    //e
                           {SEGL+1,  SEGL+2,       true},    //f
                           {0, 0,                  false}};  //g

#endif