#include "bsp.h"
void AdcInit(void)
{
        CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);
	ADC_Init(ADC1,ADC_ConversionMode_Single,ADC_Resolution_12Bit,ADC_Prescaler_1);
	ADC_SamplingTimeConfig(ADC1, ADC_Group_SlowChannels, ADC_SamplingTime_384Cycles);
	ADC_Cmd(ADC1,ENABLE); 
        ADC_Cmd(ADC1,DISABLE);      
}
void bsp_init(void)
{
      disableInterrupts();
      bsp_clk_init();
      bsp_time4_init();
      bsp_usart_init();
      SpiInit1();
      bsp_gpio_init();
      SoftDelayMs(10);
      FixedParaDeal();
      SoftDelayMs(10);
      printf("AT+RST:OK!\r\n");
      WatchDogInit();
      enableInterrupts();
}


void WatchDogInit(void)
{
    IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);//允许操作独立看门狗
    IWDG_SetPrescaler(IWDG_Prescaler_256);//看门狗预分频
    IWDG_SetReload(IWDG_500MS_REST);//设置看门狗复位时间
    IWDG_Enable();//启动独立看门狗
}

void FeedWatchDog(void)
{
    IWDG_ReloadCounter();//看门狗复位 正常使用时不想发生看门狗复位，就执行
}
  
  
  
  
