#ifndef _PANEL_H_
#define _PANEL_H_

#include "timelib.h"
#include "fat.h"
#include "fat_config.h"
#include "partition.h"
#include "sd_raw.h"
#include "sd_raw_config.h"
#include "uart.h"
#include "measuring.h"


typedef enum
{
    Vertical =  0,
    Horizontal  =  1

} MenuOrientation;

typedef struct {
    unsigned char Uroven;
    unsigned char Radek;
    unsigned char AktualDelka;
    unsigned char Offset;
    unsigned char Bottom;
    unsigned char PocetPolozek;
    MenuOrientation Orientation;
    unsigned char Contrast;
    unsigned char Brightness;
    unsigned char Error;

} sMenu;

typedef struct {
    struct partition_struct* partition;
    struct fat_fs_struct* fs;
    struct fat_dir_struct* dd;


} sSdCard;

// Doba pauzy tlacitka

#define TlacPause               65

// Definice klavesnice

#define KlavPort               PORTA
#define KlavDDR                DDRA
#define KlavPIN                PINA
#define KlavUp                 PA1
#define KlavDow                PA5
#define KlavLef                PA4
#define KlavRig                PA2
#define KlavOk                 PA3



// define Menu

//_______________________Urovne

#define uHlavni               1
#define uNew                  2
#define uOpen                 3
#define uSetting              4
#define uSetTime              5
#define uMeasuring            6

//________________________Radky

#define rNew                  1
#define rOpen                 2
#define rSetting              3
#define rSetTime              3
#define rContrast             1
#define rBrightness           2


// Funkce

unsigned char DirNumFile(sSdCard *fSdCard);
void DrawPanel();
void DrawMenu(sMenu *fMenu, const sTime fTime, sSdCard *fSdCard);

unsigned char PanelLoop(sMenu *fMenu, sSdCard *fSdCard,sMeasuring *fMeasuring);



#endif

