/*      mija 2009 - header for proces.c

        SW pro ATmega8 mereni + regulace teploty
        Fosc = 8192000Hz externi krystal

        ver.: 0.0 - start
                 
*/

#ifndef __process_h_included__
#define __process_h_included__

#include "clock.h"              // struc Clock_t

#define POSITIVTIME             15      //minuty
#define DRYTIME                 120     //minuty

#define POSITIVTEMP             70      //°C 
#define DRYTEMP                 80      //°C 

#define PREHEATTEMPSTART        100
#define PREHEATTEMPSTOP         150
#define PREHEATTIMEOFF          50 //sec                

#define PREHEATTEMP             126     //°C 

#define PREHEATTIME             120     //sec

#define SOLDERTEMPSTART 183
#define SOLDERTEMPSTOP  180

#define SOLDERTEMP              206     //°C 
#define SOLDERTIME              10      //sec

#define COOLTEMP                50      //°C 
#define COOLTIME                10      //sec

#define HEAT            PD7
#define HEAT_DDR        DDRD
#define HEAT_PORT       PORTD

#define MAXDISPLBUFFER  20      //buffer pro lcd display 

enum{START=0,SOLDER,POSITIV,DRY}; //main proces

uint8_t         ProcesStart(char *buffer,uint8_t key,uint16_t temp);
uint8_t         ProcesSolder(char *buffer,uint8_t key,uint16_t temp,Clockt_t *clock);
uint8_t         ProcesPositiv(char *buffer,uint8_t key,uint16_t temp,Clockt_t *clock);
uint8_t         ProcesDry(char *buffer,uint8_t key,uint16_t temp,Clockt_t *clock);

void            ProcesDispl(char *data);
void            ProcesTemp(uint16_t adc,uint16_t *temp);
void            ProcesHeat(uint16_t temp,uint16_t ActualTemp);

 #define HeatInit()     HEAT_DDR|=_BV(HEAT)
 #define HeatOn()       HEAT_PORT|=_BV(HEAT)
 #define HeatOff()  HEAT_PORT &= (~(_BV(HEAT)))

#endif /* __process_h_included__ */