/*
 * BackgroundServices.h
 *
 * Created: 04-Apr-17 14:55:29
 *  Author: maticpi
 */ 

#ifndef BACKGROUNDSERVICES_H_
#define BACKGROUNDSERVICES_H_

#include <avr/io.h>
#include <string.h>
#include "LCD_Ili9341.h"
#include "systime.h"
#include "kbd.h"

extern char kartice[2][5];
extern char display_msg;


#define DISP_NO_CHANGE			0
#define DISP_CARD1				1
#define DISP_CARD2				2
#define DISP_CARD3				3
#define DISP_CARD4				4
#define DISP_CARD5				5
#define DISP_CARD6				6
#define DISP_CARD7				7
#define DISP_CARD8				8
#define DISP_CARD9				9
#define DISP_CARD10			    10
#define CUR_MSG_OFFSET			20
#define DISP_CUR1				1+CUR_MSG_OFFSET
#define DISP_CUR2				2+CUR_MSG_OFFSET
#define DISP_CUR3				3+CUR_MSG_OFFSET
#define DISP_CUR4				4+CUR_MSG_OFFSET
#define DISP_CUR5				5+CUR_MSG_OFFSET
#define DISP_CUR6				6+CUR_MSG_OFFSET
#define DISP_CUR7				7+CUR_MSG_OFFSET
#define DISP_CUR8				8+CUR_MSG_OFFSET
#define DISP_CUR9				9+CUR_MSG_OFFSET
#define DISP_CUR10			    10+CUR_MSG_OFFSET

#define CUR_MSG_OFFSET3			50
#define CLEAR_CARD1				1+CUR_MSG_OFFSET3
#define CLEAR_CARD2				2+CUR_MSG_OFFSET3
#define CLEAR_CARD3				3+CUR_MSG_OFFSET3
#define CLEAR_CARD4				4+CUR_MSG_OFFSET3
#define CLEAR_CARD5				5+CUR_MSG_OFFSET3
#define CLEAR_CARD6				6+CUR_MSG_OFFSET3
#define CLEAR_CARD7				7+CUR_MSG_OFFSET3
#define CLEAR_CARD8				8+CUR_MSG_OFFSET3
#define CLEAR_CARD9				9+CUR_MSG_OFFSET3
#define CLEAR_CARD10			10+CUR_MSG_OFFSET3

#define CUR_MSG_OFFSET2			30
#define CLEAR_CUR1				1+CUR_MSG_OFFSET2
#define CLEAR_CUR2				2+CUR_MSG_OFFSET2
#define CLEAR_CUR3				3+CUR_MSG_OFFSET2
#define CLEAR_CUR4				4+CUR_MSG_OFFSET2
#define CLEAR_CUR5				5+CUR_MSG_OFFSET2
#define CLEAR_CUR6				6+CUR_MSG_OFFSET2
#define CLEAR_CUR7				7+CUR_MSG_OFFSET2
#define CLEAR_CUR8				8+CUR_MSG_OFFSET2
#define CLEAR_CUR9				9+CUR_MSG_OFFSET2
#define CLEAR_CUR10				10+CUR_MSG_OFFSET2

#define DISP_CARD_NONE			11
#define DISP_CARD_ALL			12
#define DISP_REFRESH_ALL		13
#define DISP_START_SCREEN		14
#define DISP_GAME_PLAY_SCREEN	15
#define DISP_END_SCREEN			16
#define REFRESH_CURSOR			17




void BackgroundServices();
void RefreshLCDandLEDs();
void LCD_ShowCard(char mole_nr);
void LCD_ClearCard(char card_nr);
void showCursor(char card_nr);
void clearCursor(char card_nr);
void DrawStartScreen();
void DrawGamePlayScreen();
void DrawEndScreen();

void DrawIcon_P(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t bgClr, uint16_t fgClr, const uint8_t *data);
void DrawSprite_P(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t bgClr, const uint16_t *data);
extern const PROGMEM uint16_t sprites[5][31][30];

extern const PROGMEM uint8_t lifeIco[11][2];
#endif /* BACKGROUNDSERVICES_H_ */