#ifndef __MAIN_H_
#define __MAIN_H_
#include "stm32f0xx_conf.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include "sys.h"


//功能配置
#if defined (STM32F030)
#define SYSLed_def			(0)
#define key4_def			(0)
#define LCD_def				(1)
#define HC_SR04_def			(1)
#define WIFI_Uart1_def		(1)

#define Pull_up_down_def	(0)
//wifi注册ID\服务器ID\目标ID
#define SERVER_ID			0x00
#define REGMY_ID			0x03
#define AIM_ID				0x02
#endif


/*SYSLed_def*/
#define LED_RCC_CONFIG			(RCC_AHBPeriph_GPIOA)
#define LED_PORT_CONFIG			(GPIOA)
#define LED_PIN_CONFIG			(GPIO_Pin_4)

/*key4_def*/
#define KEY4_RCC_CONFIG			(RCC_AHBPeriph_GPIOB)
#define KEY4_PORT_CONFIG		(GPIOB)
#define KEY4_INPIN_CONFIG		(GPIO_Pin_1)

/*HC_SR04_def*/
#define SR04_RCC_CONFIG			(RCC_AHBPeriph_GPIOA)
#define SR04_PORT_CONFIG		(GPIOA)
#define SR04_OUTPIN_CONFIG		(GPIO_Pin_5|GPIO_Pin_7)
#define SR04_INPIN_CONFIG		(GPIO_Pin_6)
#define SR04_INPIN_Pre			(1)

/*LCD_def*/
#if defined (STM32F030)
#define LCD_QC12864B_RCC		(RCC_AHBPeriph_GPIOA)
#define LCD_QC12864B_PORT		(GPIOA)
#define LCD_QC12864B_PIN		(GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4)
#endif

/*WIFI_Uart1_def*/
//UART1
#define Wifi_SEL_UART			(1)
#if(Wifi_SEL_UART == 1)
/****** RCC 配置******/
//波特率
#define Wifi_UART_BAUD			(115200)
/****** GPIO 配置******/
//UART端口号
#define Wifi_GPIO				(GPIOA)
#define Wifi_Tx					(GPIO_Pin_9)
#define Wifi_Rx					(GPIO_Pin_10)
//串口号
#define Wifi_UART				(USART1)
/****** UART优先级******/
#define Wifi_NVIC_Group			(NVIC_PriorityGroup_0)
#define Wifi_NVIC_Interrupt		(USART1_IRQn)				//uart1中断号
#define Wifi_NVIC_Pre			(3)
#endif
//复位脚 PB10
#define Reset_IORCC 			(RCC_APB2Periph_GPIOB)	//Reset对应IO的时钟
#define Reset_PORT				(GPIOB)
#define Reset_Pin				(GPIO_Pin_4)


#define bit  u8
#define INT8U  u8
#define INT16U u16

typedef struct aa
{
    INT8U a: 1 ;
    INT8U b: 1 ;
    INT8U c: 1 ;
    INT8U d: 1 ;
    INT8U e: 1 ;
    INT8U f: 1 ;
    INT8U g: 1 ;
    INT8U h: 1 ;
} cc ;

extern cc Status0 , Status1 , Status2, Status3;

#define System_Flag_2Ms	        Status2.a
#define System_Flag_10Ms        Status2.b
#define System_Flag_100Ms       Status2.c
#define System_Flag_200Ms       Status2.d
#define System_Flag_500Ms	    Status2.e
#define System_Flag_1s        	Status2.f
#define System_Flag_8s       	Status2.g
#define System_Flag_20s       	Status2.h



#endif

