示例#1
0
/***********************************************************
*   函数说明:系统硬件初始化函数                           *
*   输入:    无                                           *
*   输出:    无                                           *
*   调用函数:Port_Init()  RCC_Configuration()             *
***********************************************************/
void Device_Init(void)
{
	RCC_Configuration();
	get_sig_cfg_param(1);

	PORT_Init();/*此处需要修改  malooei  2012/11/14*/

	USART2_Configuration(); /* 用于连接pc */

	USART1_Configuration(); /* 用于向光纤传输数据 */
	DMA_USART1_Configuration( );

	adc1_dma_cfg();
	ADC1_Configuration();

	//box_tmper_ctrl_init();

#if !USE_PVD_CHECK_POWEROFF
	Exti_Init();
#else
	Exti_Pvd_Init();
#endif

	spi1_cfg4ads8329();
	delay_us(500*1000); /* 240ms, cpu最低工作电压为2.0V, ads8329最低工作电压为2.7V, David */
	init_ads8329();

	TIM3_Configuration();

	NVIC_Configuration();

	return;
}
示例#2
0
int main(void)
{
    // Hardware Init
    delay_init();	    	 //ÑÓʱº¯Êý³õʼ»¯
    pwr_init();
    #ifdef YANMING3
    charger_init();
    if (check_standby_flag() == SUCCESS && check_charging() != CHARGING) {
        Key_GPIO_Config();
        exti_key_init();
        #ifdef DEBUG_POWER_OFF_WAKE_UP
        Screen_Init();
        OLED_Clear();
        OLED_Display_On();
        draw_about_mesage();
        #endif
        check_standby_wakeup_button_press();
        // If we boot up from standby by pressing 5 times, the system will reboot again without
        // this code block.
    }
    #endif

    // OLED Init
    Screen_Init();
    OLED_Clear();
    
    //
    low_switch_power_init();

    TIMx_Int_DeInit();
    EXTIX_DeInit();
    
    // Key
    Key_GPIO_Config();
    
    // PID related code
    ADC1_Configuration();
    PWM_Configuration();
    VoltagePID_Init();

    TIMx_Int_Init();
    rtc_init();

    // Our Init
    system_init();
    #ifndef YANMING3
    //iwdg_init();
    #endif

    while(1) {
        #ifndef YANMING3
        //iwdg_feed();
        #endif
        task_schedule();
    }
}
示例#3
0
文件: main.c 项目: emmamuelo/IPM
/**  
  * @brief  Main program  
  * @param   None.  
  * @retval : None.  
  */   
int main(void)   
{   
    /* System clocks configuration */   
    RCC_Configuration();   
    /* NVIC configuration*/   
    NVIC_Configuration();   
    /* GPIO configuration ----------------------------------------------------*/   
    GPIO_Configuration();   
#ifdef master   
    /* Master configuration --------------------------------------------------*/   
    Master_Configuration();   
#endif   
#if defined(slave1) || defined(slave2)   
    /* Slave configuration ---------------------------------------------------*/   
    Slave_Configuration();   
   
    /* ADC1 configuration ----------------------------------------------------*/   
    ADC1_Configuration();   
   
    /* ADC DMA Channel1 configuration */   
    DMA_Channel1_Configuration();   
#endif   
   
#ifdef  DMA_Master_Receive   
    DMA_Channel7_Configuration();   
#endif   
   
#ifdef  DMA_Slave_Transmit   
    DMA_Channel4_Configuration();   
#endif   
   
#ifdef  master   
    /* TIM2 configuration ----------------------------------------------------*/   
    TIM2_Configuration();   
#endif   
   
    while (1)   
    {   
#if defined(slave1) || defined(slave2)   
        I2C_Slave_BufferWrite(Slave_Buffer_Tx,  255);   
#endif   
    }   
   
}