//kniznica.h

#ifndef KNIZNICA_H
#define	KNIZNICA_H

//define pins
#define Btn_LDO         !PORTAbits.RA0
#define Btn_boost       !PORTAbits.RA1
#define Btn_buck        !PORTAbits.RA2
#define Btn_pump        !PORTAbits.RA3
#define Btn_in          !PORTAbits.RA4

#define LED_in           PORTAbits.RA6
#define LED_pump         PORTCbits.RC0
#define LED_LDO          PORTCbits.RC1
#define LED_boost        PORTCbits.RC2
#define LED_buck         PORTCbits.RC3
#define LED_load_LDO     PORTEbits.RE0
#define LED_load_boost   PORTEbits.RE1
#define LED_load_buck    PORTEbits.RE2

#define SW_LDO           LATFbits.LF0
#define SW_boost         LATFbits.LF1
#define SW_buck          LATFbits.LF2
#define SW_pump          LATFbits.LF3
#define SW_load_LDO      LATFbits.LF5
#define SW_load_boost    LATFbits.LF6
#define SW_load_buck     LATFbits.LF7

extern char status_Btn_in, status_Btn_LDO, status_Btn_boost, status_Btn_buck, status_Btn_pump; 
extern char status_Btn_in_prev, status_Btn_LDO_prev, status_Btn_boost_prev, status_Btn_buck_prev, status_Btn_pump_prev; 
extern char Btn_in_count; 
extern char buffer[16];
extern uint8_t supply_state, variable, status_variable, variable_change, first_row;
extern float temp;
extern uint16_t resultAD;

#define _XTAL_FREQ 4000000

//functions
void pinSet (void);
void initTimer (void);
void initAdc (void);
void initB (void);
void supplyOff (void);
void supplySet (unsigned int zdroj);
float temperatureMeasure (uint8_t bits);
void updateTemperature (void);
void displaySupply (void);

#endif	/* KNIZNICA_H */

