Ejemplo n.º 1
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
     */ 
	LED_Configuration();
	SysTick_Configuration();
	USART_Configuration();
	Buzzer_Configuration();
	LED_Interrupt();//¿ªÆô¶¨Ê±Æ÷ÖжÏ
	PWM_Configuration();

	LED_Set(0x00);
  /* Infinite loop */
  while (1)										 
  {
// 	Set_Speed(1,50,0);
//	Set_Speed(2,50,0);
//	Buzzer_ON();
//	delay_ms(1000);
//	Set_Speed(1,50,1);
//	Set_Speed(2,50,1);
//	Buzzer_ON();
//	delay_ms(1000);
	switch(instruction)
	{
		case 'a': 
			Set_Speed(1,50,1);
			Set_Speed(2,50,1);
			break;
		case 'b': 
			Set_Speed(1,50,1);
			Set_Speed(2,50,0);
			break;	
		case 'c': 
			Set_Speed(1,50,0);
			Set_Speed(2,50,1);
			break;
		case 'd': 
			Set_Speed(1,50,0);
			Set_Speed(2,50,0);
			break;
		case 's': 
			Set_Speed(1,0,0);
			Set_Speed(2,0,0);
			break;
		case 'z':
				Buzzer_ON();
				break;
		case 'y':
				Buzzer_OFF();
				break;
		 default: break;
										
	}


  }
}
Ejemplo n.º 2
0
void System_Configuration(void)
{

	__disable_interrupt();
	/* System Clocks Configuration */
	RCC_Configuration();
	   
	/* NVIC configuration */
	NVIC_Configuration();


	/* Configure the GPIO ports */
	GPIO_Configuration();



	/* Unlock the Flash Program Erase controller */
	FLASH_Unlock();

	/* USART Configuration */
	USART_Configuration(USART_DXL,Baudrate_DXL);
	//dxl_initialize(USART_DXL,Baudrate_DXL);
	zgb_initialize(0);
	//USART_Configuration(USART_ZIGBEE,Baudrate_ZIGBEE);

	//USART_Configuration(USART_PC,1000000);
	//USART_Configuration(USART_PC,3000000);
	USART_Configuration(USART_PC,Baudrate_PC);


	/* ADC Configuration */
	ADC_Configuration();
	
	

	SysTick_Configuration();
	
	Timer_Configuration();


	SPI_Configuration();

	Buzzer_Configuration();


	GPIO_ResetBits(PORT_ENABLE_TXD, PIN_ENABLE_TXD);	// TX Disable
	GPIO_SetBits(PORT_ENABLE_RXD, PIN_ENABLE_RXD);	// RX Enable
	GPIO_SetBits(PORT_SIG_ACC_CS,PIN_SIG_ACC_CS);
	GPIO_SetBits(PORT_SIG_GYRO_CS,PIN_SIG_GYRO_CS);

	__enable_interrupt();



	Gyro_Configuration();
	ACC_Configuration();






}