Esempio 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_stm32xxx_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32xxx.c file
  */
	Printf_Init();

  	/* Output a message on Hyperterminal using printf function */
  	printf("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");

   /* Initialize TIM6 */
  TIM6_Config();
#if 0
  /* Start CPAL communication configuration ***********************************/
  /* Initialize local Reception structures */
  sRxStructure.wNumData = BufferSize;       /* Maximum Number of data to be received */
  sRxStructure.pbBuffer = tRxBuffer;        /* Common Rx buffer for all received data */
  sRxStructure.wAddr1 = 0;                  /* Not needed */
  sRxStructure.wAddr2 = 0;                  /* Not needed */

  /* Initialize local Transmission structures */
  sTxStructure.wNumData = BufferSize;       /* Maximum Number of data to be received */
  sTxStructure.pbBuffer = (uint8_t*)tStateSignal;     /* Common Rx buffer for all received data */
  sTxStructure.wAddr1 = OWN_ADDRESS;        /* The own board address */
  sTxStructure.wAddr2 = 0;                  /* Not needed */

  /* Configure the device structure */
  CPAL_I2C_StructInit(&I2C_DevStructure);      /* Set all fields to default values */
  I2C_DevStructure.CPAL_Mode = CPAL_MODE_SLAVE;
#ifdef CPAL_I2C_DMA_PROGMODEL
  I2C_DevStructure.wCPAL_Options =  CPAL_OPT_NO_MEM_ADDR | CPAL_OPT_DMATX_TCIT | CPAL_OPT_DMARX_TCIT;
  I2C_DevStructure.CPAL_ProgModel = CPAL_PROGMODEL_DMA;
#elif defined (CPAL_I2C_IT_PROGMODEL)
  I2C_DevStructure.wCPAL_Options =  CPAL_OPT_NO_MEM_ADDR;
  I2C_DevStructure.CPAL_ProgModel = CPAL_PROGMODEL_INTERRUPT;
#else
 #error "Please select one of the programming model (in main.h)"
#endif
  I2C_DevStructure.pCPAL_I2C_Struct->I2C_ClockSpeed = I2C_SPEED;
  I2C_DevStructure.pCPAL_I2C_Struct->I2C_OwnAddress1 = OWN_ADDRESS;
  I2C_DevStructure.pCPAL_TransferRx = &sRxStructure;
  I2C_DevStructure.pCPAL_TransferTx = &sTxStructure;

  /* Initialize CPAL device with the selected parameters */
  CPAL_I2C_Init(&I2C_DevStructure);
#endif

	BMP085_Config();
  /* Infinite loop */
  while (1)
  {

  }
}
Esempio n. 2
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured to 
       168 MHz, this is done through SystemInit() function which is called from
       startup file (startup_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */ 
	 
	   int TestStatus; 

#ifdef SERIAL_DEBUG
  //DebugComPort_Init();
#endif
  
  Printf_Init();

    
  printf("long = %d int = %d short = %d char = %d\r\n", sizeof(long), sizeof(int), sizeof(short), sizeof(char));
  /*Initialize LCD and Leds */ 
  LCD_LED_Init();

  TestStatus = CAN1_Config();
	if(TestStatus == -1)
	{
		printf("CAN1_Config failed\r\n"); 	
	}
	else
	{
		printf("CAN1_Config success\r\n");
	}
  /* configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  //ETH_BSP_Config();

 // printf("\n\r\r\n ARMJISHU.COM神舟王STM32F407ZGT开发板 FreeRTOS V6.1.0 httpserver_netconn 例程\r\n"); 
    
  /* Initilaize the LwIP stack */
  //printf("\n\r LwIP_Init\r\n");
 // LwIP_Init();
  
  /* Initialize webserver demo */
  //http_server_socket_init();
  //printf("\n\r FreeRTOS V6.1.0 http_server_socket_init: sys_thread_new HTTP\r\n");

#ifdef USE_DHCP
  /* Start DHCPClient */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate LwIP_DHCP_task\r\n");
  xTaskCreate(LwIP_DHCP_task, "DHCPClient", configMINIMAL_STACK_SIZE * 2, NULL,DHCP_TASK_PRIO, NULL);
#endif
    
  /* Start toogleLed4 task : Toggle LED4  every 250ms */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate ToggleLed4\r\n");
  xTaskCreate(ToggleLed4, "LED4", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);

  /* Start toogleLed1 task : Toggle LED1  every 250ms */
  //printf("\n\r FreeRTOS V6.1.0 xTaskCreate ToggleLed1\r\n");
  //xTaskCreate(ToggleLed1, "SZWLED1", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);
    
  /* Start toogleLed2 task : Toggle LED2  every 250ms */
  //printf("\n\r FreeRTOS V6.1.0 xTaskCreate ToggleLed2\r\n");
  //xTaskCreate(ToggleLed2, "SZWLED2", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);

  /* Start toogleLed3 task : Toggle LED3  every 250ms */
  //printf("\n\r FreeRTOS V6.1.0 xTaskCreate ToggleLed3\r\n");
  //xTaskCreate(ToggleLed3, "SZWLED3", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);

  /* Start scanDevices task  */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate can1Send\r\n");
  xTaskCreate(can1Send, "CAN1SEND", configMINIMAL_STACK_SIZE, NULL, CAN_TASK_PRIO, NULL);

  /* Start can1 receive task  */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate can1Rec\r\n");
  xTaskCreate(can1Rec, "CAN1REC", configMINIMAL_STACK_SIZE, NULL, CAN_TASK_PRIO+1, NULL);

  /* Start can1 do command task  */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate doCommand\r\n");
  xTaskCreate(doCommand, "DCMMD", configMINIMAL_STACK_SIZE, NULL, CAN_TASK_PRIO+2, NULL);
  
   
  /* Start scheduler */
  printf("\n\r FreeRTOS V6.1.0 Start scheduler\r\n");
  vTaskStartScheduler();

  /* We should never get here as control is now taken by the scheduler */
  for( ;   ; );
}