#ifndef __HWINIT
#define __HWINIT

#include "common.h"

//Local variables
GPIO_InitTypeDef GPIO_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
USART_InitTypeDef USART_InitStructure;

//Global function
void HW_Init(void);
void Clock_Init(void);

#define BACKUP_ON_VOLTAGE 4228
#define BACKUP_OFF_VOLTAGE 4589

#define ACTIVE_TIMEOUT_MAINS 90
#define ACTIVE_TIMEOUT_BATTERY 15


#define BACKUP_ON_THRESHOLD ((4096/3300)*((BACKUP_ON_VOLTAGE)/2))
#define BACKUP_OFF_THRESHOLD ((4096/3300)*((BACKUP_OFF_VOLTAGE)/2))

#define BATT_WARNING_LEVEL	3500

//Local functions

void GPIO_Configuration(void);
void NVIC_Configuration(void);
void RCC_Configuration(void);
void EXTI_Configuration(void);
void I2C_Configuration(void);
void SERIAL_Configuration(void);
void SysTick_Configuration(void);
void TIMERS_Configuration(void);
void EXTI_Configuration(void);
void ADC_Configuration(void);

#endif
