Ejemplo n.º 1
0
Archivo: main.c Proyecto: Ilydan/ROwen
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_COMP1_Init();
  MX_COMP2_Init();
  MX_I2C1_Init();
  MX_TIM3_Init();
  MX_USART1_UART_Init();
	MX_ADC_Init();
	MX_DMA_Init();

  /* USER CODE BEGIN 2 */
  init_all();
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
		period_time_check_flags();
//		if (HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_4) != GPIO_PIN_RESET)
//		{
//			HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_10);
//			buzzer(beeps,1);
//			buzzer_speed(100);
//		}
		
		
		
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */
		speed_counter++;
  }
  /* USER CODE END 3 */

}
Ejemplo n.º 2
0
/**
  * @brief  Main program.
  * @param  None 
  * @retval None
  */
int main(void)
{  
	
	init_ALL();
	USART_puts(USART3, "System initialized\n");
	Delay(3000);
	
	//----------calibrate ESC---------------
 //	USART_puts(USART3, "ESC calibrating ...\n");
//	ESC_Calibrate_All();
	//----------calibrate ESC---------------
	
	
	//----------motor test---------------
	/*
	USART_puts(USART2, "Test motors: 8000\n");
	STM_EVAL_LEDOn(LED9);
  test_motors(1000);
	STM_EVAL_LEDOff(LED9);
	*/
	//----------motor test---------------



//	//----------main program----------
//  SetTunings(20, 50, 10); //PID setting
//	M1_speed = 3000;  			//main motor speed
//	M2_speed = 3000; 				//main motor speed
//	M3_speed = 3000;  			//main motor speed
//	M4_speed = 3000;				//main motor speed
//	ESC_recompute();				//main motor speed
//	
	while (1)
	{
		period_time_check_flags();
		USART_manage_RX();
	}
	
	//----------main program----------
}