Ejemplo n.º 1
0
/*-----------------------------------------------------------*/
void prvSetupHardware( void )
{
	/* Set the Vector Table base address at 0x08000000 */
	NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );
	NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );

	/* Configure LED IOs as output push-pull */
    /* Initialize LEDs on STM32F4_Discovery board */
	//prvLED_Config(GPIO);
	/* Configure User button pin (PA0) as external interrupt -> modes switching */
	STM_EVAL_PBInit(BUTTON_USER,BUTTON_MODE_EXTI);

	/* Configuration of Timer4 to control LEDs based on MEMS data */
	//prvTIM4_Config();

	/* Configure LIS302 in order to produce data used for TIM4 reconfiguration and LED control */
	prvMEMS_Config();

  	RCC_Configuration();
  	GPIO_Configuration();
  	TIM_Configuration();
  	USART_Configuration();
  	prvGRYO_Config();
	
}
Ejemplo n.º 2
0
/* Main Initfunction --------------------------------------------------------*/
void initSystem()
{
    /* Configure the system clocks */
    RCC_Configuration();
    /* Configure TIMs */
    TIM_Configuration();
    /* Configure the GPIO ports UART */
    GPIO_Configuration();
    /* UART Interrupt */
    NVIC_Configuration();
    initUART1();
    initUART2();
    initUART3();
    //initUART4();
    /* initDMA for Sensors */
    initDMA();
    /* initADC for Sensros */
    initADC();
    /* inti System Ticker */
    /* does not work in Interrupt */
    /* Pause(ms) function */
    initSysTick();
    /* init I2C1 for Compas */
    initI2C();
}
Ejemplo n.º 3
0
int main(void)
{
	RCC_Configuration();
	GPIO_Configuration();
	TIM_Configuration();
	while(1);
}
Ejemplo n.º 4
0
void adc_hw_init(void)
{
 GPIO_Configuration();
 TIM_Configuration();
 DMA_Configuration();
 ADC_Configuration();
 NVIC_Configuration();
 
}
Ejemplo n.º 5
0
void BSPINIT(void)
{
    RCC_Init();		                //所有时钟使能
	  GPIO_init();	 
    adc_init();
    TIM3_Int_Init(999,10);
	TIM8_PWM_Init(999,10);       //1200Hz
  TIM_Configuration();	        //  TIM7主中断设置						
  flag=0;
}
Ejemplo n.º 6
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main()
{
    RCC_Configuration();
    GPIO_Configuration();
    SysTick_Configuration();
    TIM_Configuration();

    while(1)
    {
        GPIO_SetBits(GPIOC,GPIO_PIN_0);
        Delay_1ms(1000);
        GPIO_ResetBits(GPIOC, GPIO_PIN_0);
        Delay_1ms(1000);
    }    
}
Ejemplo n.º 7
0
/**
  * @brief   Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f10x_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f10x.c file
     */  
       
  /* Configure the system clocks */
  RCC_Configuration();

  /* Initialize Leds mounted on STM3210X-EVAL board */
  STM_EVAL_LEDInit(LED1);
  STM_EVAL_LEDInit(LED2);
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);

  /* Configure TIMs */
  TIM_Configuration();
       
  /* Configure two bits for preemption priority */
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
  
  /* Enable the TIM2 Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
  
  /* Enable the TIM3 Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
  NVIC_Init(&NVIC_InitStructure);
 
  /* Enable the TIM4 Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = TIM4_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
  NVIC_Init(&NVIC_InitStructure); 
    
  while (1)
  {     
  }
}
Ejemplo n.º 8
0
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
	/* System Clocks Configuration */
	RCC_Configuration();

	/* GPIO Configuration */
	GPIO_Configuration();

	/* Timer Configuration */
	TIM_Configuration();

	/* Network Configuration */
	Network_Configuration();

	while (1)
	{
		Network_Process();
	}
}
Ejemplo n.º 9
0
void vidInit(void)
{
	/*Populate DMA_TEST*/
	//int i=0;
	//int a=0xFF;
	
	/*for(i=0; i<100;i++){
		if(i%2 != 0)
		DMA_TEST[0][i]=a;
	}*/
	
	vidClearScreen();
	TIM8_Init();
	TIM_Configuration();
	DMA_Config();
	//TIM5_Init();
	
	
}
Ejemplo n.º 10
0
//------------------------------------------------------------------------------
//                       	=== Initialize Function ===
//------------------------------------------------------------------------------
void Init_Main(void)
{
    RCC_Configuration();
    //RCC_GetClocksFreq(&rcc_clocks);
	GPIO_Configuration();
	NVIC_Configuration();
	DMA_Configuration();
	ADC_Configuration();
	TIM_Configuration();
	EXTI_Configuration();
    Tim_Encoder_initial();
	
    USART1_Init(57600);	// in 36mhz error 0%
    USART3_Init(115200);// in 72mhz error 0%
    //if (SysTick_Config(rcc_clocks.SYSCLK_Frequency / 1000))
    //{ 
        /* Capture error */
    //    while (1);
    //}
}
Ejemplo n.º 11
0
//**************************************************************************************
int main(void)
{
	RCC_Configuration();
	GPIO_Configuration();
	ClearSoundBuffers();
	TIM_Configuration();
	uint8_t i=0;
	while (1)
    {
		OutFrequence(200,1,500,100);
		OutFrequence(900,0,500,100);
		/*OutFrequence(277,0,500,750);
		OutFrequence(294,0,500,750);
		OutFrequence(311,0,500,750);
		OutFrequence(329,0,500,750);
		OutFrequence(349,0,500,750);
		OutFrequence(370,0,500,750);
		OutFrequence(392,0,500,750);
		OutFrequence(415,0,500,750);
		OutFrequence(440,0,500,750);
		OutFrequence(466,0,500,750);
		OutFrequence(494,0,500,750);*/
    };
}
Ejemplo n.º 12
0
void PWM_init(void)
{
    RCC_Configuration();
    TIM_Configuration();
    GPIO_Configuration();
}
Ejemplo n.º 13
0
int main()
{
  RCC_Configuration();
  NVIC_Configuration();
  GPIO_Configuration();
 
  USART_Configuration(USART3, 230400); 
  USART_Configuration(USART2, 9600);
  USART_Configuration(UART4, 9600);
  
  TIM_Configuration();
  initailze_wifiSet();
  Initailze_value();
  
  GPIO_SetBits(GPIOB, GPIO_Pin_0);
  delay_ms(100);
       
  while(!Wifi_fly_Set)
 {
    if(Wifi_Connect)
    {
      printf("AT+CIPSEND=0,21\n");
      delay_ms(150);
      printf("Angle,NN\n");     
      delay_ms(350);
    }
 }
  delay_ms(150);
  Send_Count = 0;
  while(1) {     
   
      
      if((Send_Count%5) == 0)        Tx_Data16t(USART3, 0x5555);
      else if((Send_Count%5) == 1)   Tx_Data16t(USART3, Drone_Control.axis[ROLL].Target);
      else if((Send_Count%5) == 2)   Tx_Data16t(USART3, Drone_Control.axis[PITCH].Target);
      else if((Send_Count%5) == 3)   Tx_Data16t(USART3, Drone_Control.Throttle);
      else if((Send_Count%5) == 4)   Tx_Data16t(USART3, 0xFFFF);

      if(Send_Exit)
      {
        GPIO_ResetBits(GPIOB, GPIO_Pin_1);
        if(Send_Exit > 200)  {   Drone_Control.Throttle = 100; /*Send_Throttle = 0; */  }
        else                 {   Send_Exit++;   }
      }
      
            
      if(Wifi_Land_Set) {
        Send_Throttle = 0;
        if(Drone_Control.axis[HEIGHT].Current < 3000){ Send_Exit = 1;  Wifi_Land_Set = 0;}
        else Drone_Control.Throttle -= 2; 
      }  
      
      if(Send_Count == 4){
     
        GPIO_SetBits(GPIOA, GPIO_Pin_8);
        delay_us(10);
        GPIO_ResetBits(GPIOA, GPIO_Pin_8);
        if(Send_Throttle)  PID_Control();
        Send_Count++;
      }
      
      
      else if(Send_Count == 9)
      {
        GPIO_SetBits(GPIOA, GPIO_Pin_5);
        delay_us(10);
        GPIO_ResetBits(GPIOA, GPIO_Pin_5);
 
        Send_Count = 0;
        if(Send_Throttle)  PID_Control();
        
      }
      else  Send_Count++;

      delay_ms(1);
  }
}