Esempio n. 1
0
/*=====================================================================================================*/
int main(void)
{

  SystemInit();
	//USART_Configuration(38400);
	Led_Config();
	//BLDC_Config();
	delay_ms(1000);
  I2C_Configuration();
	delay_ms(1000); 
  MPU6050_Initialize();//LSB gyro = 32.8 LSB acc = 2048
	delay_ms(1000); 
	HMC5883L_Initialize();
	delay_ms(1000);//delay to avoid hating
  IMU_Get_Offset();//read MPU6050 to calib gyro
	delay_ms(1000);//wait for MPU to stabilize
  IMU_Get_Start();
  delay_ms(1000);//delay to avoid hating
	
  TIMBase_Config();
  //Rx_Configuration();//Configuration interrupt to calculate dutycycle received from Rx
  //PID_Init_Start();
	//SysTick_Config(SystemCoreClock / 999);//start to read MPU each 1 ms
  //start PWM to test
  //BasicThr = 800;
  //printf(" Quadcopter Project\r\n");
  while (1)
  {
  }
/*=====================================================================================================*/
/*=====================================================================================================*/
}
Esempio n. 2
0
/*******************************************************************************
* Function Name  : main.
* Description    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
  Set_System();
  Set_USBClock();
  Led_Config();
  USB_Interrupts_Config();
  USB_Init();
  while (bDeviceState != CONFIGURED);

  USB_Configured_LED();

  while (1)
  {}
}
Esempio n. 3
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  float  data = 2.555;
  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, Flash preread and Buffer caches
       - Systick timer is configured by default as source of time base, but user 
             can eventually implement his proper time base source (a general purpose 
             timer for example or other time source), keeping in mind that Time base 
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
             handled in milliseconds basis.
       - Low Level Initialization
     */
  HAL_Init();

  /* Configure the system clock to 168 MHz */
  SystemClock_Config();
  /* Configure USART console*/
  retarget_init();
  Led_Config();
  /* Add your application code here
     */
 
  /* Infinite loop */
  while (1)
  {
    HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_12);
    /* Insert delay 100 ms */
    HAL_Delay(delayTime);
    HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_13);
    /* Insert delay 100 ms */
    HAL_Delay(delayTime);
    HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_14);
    /* Insert delay 100 ms */
    HAL_Delay(delayTime);
    HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_15);
    /* Insert delay 100 ms */
    HAL_Delay(delayTime);
    delayTime = delayTime +1;
    printf("hello %f \r\n", 1.55);
  }
}
Esempio n. 4
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
     */     

  Set_System();
  Set_USBClock();
  Led_Config();
  USB_Interrupts_Config();
  USB_Init();  
  
  /* Initialize LEDs, Key Button, LCD and COM port(USART) available on
     STM3210X-EVAL board ******************************************************/
  STM_EVAL_LEDInit(LED1);
  STM_EVAL_LEDInit(LED2);
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);

  /* USARTx configured as follow:
        - BaudRate = 115200 baud  
        - Word Length = 8 Bits
        - One Stop Bit
        - No parity
        - Hardware flow control disabled (RTS and CTS signals)
        - Receive and transmit enabled
  */
  USART_InitStructure.USART_BaudRate = 115200;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

  STM_EVAL_COMInit(COM1, &USART_InitStructure);

  /* Initialize the LCD */
#ifdef USE_STM32100B_EVAL
  STM32100B_LCD_Init();
#elif defined (USE_STM3210B_EVAL)
  STM3210B_LCD_Init();
#elif defined (USE_STM3210E_EVAL)
  STM3210E_LCD_Init();
#elif defined (USE_STM3210C_EVAL)
  STM3210C_LCD_Init();
#endif

  /* Display message on STM3210X-EVAL LCD *************************************/
  /* Clear the LCD */ 
  LCD_Clear(White);

  /* Set the LCD Back Color */
  LCD_SetBackColor(Blue);
  /* Set the LCD Text Color */
  LCD_SetTextColor(White);
  LCD_DisplayStringLine(Line0, MESSAGE1);
  LCD_DisplayStringLine(Line1, MESSAGE2);
  LCD_DisplayStringLine(Line2, MESSAGE3);

  /* Retarget the C library printf function to the USARTx, can be USART1 or USART2
     depending on the EVAL board you are using ********************************/
  printf("\n\r %s", MESSAGE1);
  printf(" %s", MESSAGE2);
  printf(" %s\n\r", MESSAGE3);

  printf("This is my first usrat log from mass storage");
  /* Turn on leds available on STM3210X-EVAL **********************************/
  STM_EVAL_LEDOn(LED1);
  STM_EVAL_LEDOn(LED2);
  STM_EVAL_LEDOn(LED3);
  STM_EVAL_LEDOn(LED4);

  /* Add your application code here
     */

  /* Infinite loop */
  while (1)
  {
  }
}