예제 #1
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
 
  /*Initialize ARM BSP (LED) */ 
  bsp_InitLed();

	/* SERIAL_DEBUG */
  #ifdef SERIAL_DEBUG_ON
    DebugComPort_Init();
  #endif /* SERIAL_DEBUG */
  
//  xTaskCreate(pvTaskCode,   /*指向任务的实现函数的指针(效果上仅仅是函数名)*/
//              pcName,       /*具有描述性的任务名。这个参数不会被FreeRTOS使用*/
//              usStackDepth, /*栈空间大小,单位是字*/
//              pvParameters, /*任务函数接受一个指向void的指针(void*)*/
//              uxPriority,   /*指定任务执行的优先级,0到最高优先级(configMAX_PRIORITIES–1)*/
//              pxCreatedTask /*用于传出任务的句柄,不用则NULL代替。*/)
  /* Start toogleLed4 task : Toggle LED4  every 1s */
 // xTaskCreate(ToggleLed1, "LED1", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);

  /* Start The CANOpen Communication */
  canopen_init();

  /* Start The Lifter Control */
  start_chassis_control();
	
	start_sensor();

  /* Start scheduler */
  vTaskStartScheduler();

	/* NEVER GET HERE as control is now taken by the SCHEDULER */
	while(1){}

}
예제 #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
     */  

#ifdef SERIAL_DEBUG
  DebugComPort_Init();
#endif
  
  /*Initialize LCD and Leds */ 
  LCD_LED_BUTTON_Init();
  
  /* Configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  ETH_BSP_Config();
    
  /* Initilaize the LwIP stack */
  LwIP_Init();
      
  /* Infinite loop */
  while (1)
  {  
    /* check if any packet received */
    if (ETH_CheckFrameReceived())
    { 
      /* process received ethernet packet */
      LwIP_Pkt_Handle();
    }
    /* handle periodic timers for LwIP */
    LwIP_Periodic_Handle(LocalTime);
  }   
}
예제 #3
0
/**
  * @brief  Main task
  * @param  pvParameters not used
  * @retval None
  */
void Main_task(void * pvParameters)
{
#ifdef SERIAL_DEBUG
  DebugComPort_Init();
#endif
  
  /* configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  ETH_BSP_Config();

  /* Initialize the LwIP stack */
  LwIP_Init();

  /* Initialize tcp echo server */
  //tcpecho_init();

  /* Initialize udp echo server */
  udpecho_init();

#ifdef USE_DHCP
  /* Start DHCPClient */
  xTaskCreate(LwIP_DHCP_task, (int8_t *)"DHCP", configMINIMAL_STACK_SIZE * 2, NULL,DHCP_TASK_PRIO, NULL);
#endif

#if 0
  /* Start toogleLed4 task : Toggle LED4  every 250ms */
  xTaskCreate(ToggleLed4, (int8_t *)"LED4", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);
#endif

  for( ;; )
  {
    vTaskDelete(NULL);
  }
}
예제 #4
0
파일: main.c 프로젝트: erley/stm32-sdcard
/**
 * @brief  Main program.
 * @param  None
 * @retval None
 */
int main( void )
{
	/* At this stage the microcontroller clock setting is already configured to
       120 MHz, this is done through SystemInit() function which is called from
       startup file (startup_stm32f2xx.S) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f2xx.c file
     */

	/* USART Configuration */
	DebugComPort_Init();

	/* Initialize buttons */
	STM_EVAL_PBInit( BUTTON_WAKEUP, BUTTON_MODE_EXTI );
	STM_EVAL_PBInit( BUTTON_TAMPER, BUTTON_MODE_EXTI );
	STM_EVAL_PBInit( BUTTON_KEY   , BUTTON_MODE_EXTI );
	STM_EVAL_PBInit( BUTTON_RIGHT , BUTTON_MODE_EXTI );

	/* Initialize SPI */
	STM_EVAL_SPI_Init();

printf("\ntest tracing from embedded code\n");

	/* Handle buttons */
	xTaskCreate( HandleButtons_task, (const signed char* const)"BTN", configMINIMAL_STACK_SIZE, NULL, BTN_TASK_PRIO, NULL );

	/* Start scheduler */
	vTaskStartScheduler();

	/* We should never get here as control is now taken by the scheduler */
	for(;;);
}
예제 #5
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{

	SystemInit();
	init_systick();

#ifdef SERIAL_DEBUG
  DebugComPort_Init();  
#endif
  printf(" Artnet2WS2811 Receiver\r\n ");
  /*Initialize LCD and Leds */ 
  LED_Init();
  
  /* configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  ETH_BSP_Config();
    
  /* Initilaize the LwIP stack */
  LwIP_Init();
  
  /* tcp echo server Init */
  //tcp_echoserver_init();
  telnetserver_init();
  //artnet_init();

  ws2812_init();
  /* Initialize variables for ws2812 */

	delay_ms(20);




  /* Infinite loop */
  while (1)
  {  
    /* check if any packet received */

	  if (ETH_CheckFrameReceived())
    {
      /* process received ethernet packet */
      LwIP_Pkt_Handle();
    }
    /* handle periodic timers for LwIP */
    LwIP_Periodic_Handle(system_time);

    DRAW_LED();
  }   
}
예제 #6
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
     */
//add a long delay wait for DP83848 finish reset  
unsigned int i,j;
for(i=0;i<50;i++)
{
	for(j=0;j < 65500;j++);
}
#ifdef SERIAL_DEBUG
  DebugComPort_Init();
#endif
  
  /*Initialize LCD and Leds */ 
  LCD_LED_Init();
  
  /* configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  ETH_BSP_Config();
    
  /* Initilaize the LwIP stack */
  LwIP_Init();
  
  /* Initialize tcp echo server */
  tcpecho_init();
  
  /* Initialize udp echo server */
  udpecho_init();

#ifdef USE_DHCP
  /* Start DHCPClient */
  xTaskCreate(LwIP_DHCP_task, "DHCPClient", configMINIMAL_STACK_SIZE * 2, NULL,DHCP_TASK_PRIO, NULL);
#endif
    
  /* Start toogleLed4 task : Toggle LED4  every 250ms */
  xTaskCreate(ToggleLed4, "LED4", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);
  
  /* Start scheduler */
  vTaskStartScheduler();

  /* We should never get here as control is now taken by the scheduler */
  for( ;; );
}
예제 #7
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured to 
       120 MHz, this is done through SystemInit() function which is called from
       startup file (startup_stm32f2xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f2xx.c file
     */  
//add a long delay wait for DP83848 finish reset  
unsigned int i,j;
for(i=0;i<36;i++)
{
	for(j=0;j < 65500;j++);
}  
#ifdef SERIAL_DEBUG
  DebugComPort_Init();
#endif

  /* Initialize LCD and Leds */ 
  LCD_LED_Init();
  
  /* Configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  ETH_BSP_Config();
    
  /* Initilaize the LwIP stack */
  LwIP_Init();
      
  /* TFTP server Init */
  tftpd_init();
    
  /* Infinite loop */
  while (1)
  {  
    /* check if any packet received */
    if (ETH_CheckFrameReceived())
    { 
      /* process received ethernet packet */
      LwIP_Pkt_Handle();
    }
    /* handle periodic timers for LwIP */
    LwIP_Periodic_Handle(LocalTime);
  }   
}
예제 #8
0
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
	 */
	char pase = 0;
	char pase1 = 0;
	uint16_t duty = 0;
	char led = 0;
	int i;

	uint8_t valor_web=0;

	RCC_GetClocksFreq(&RCC_Clocks);

#ifdef SERIAL_DEBUG
	DebugComPort_Init();
	printf("STM32DISCOVERY is booting...\r\n");
#endif



	/* configure ethernet (GPIOs, clocks, MAC, DMA) */
	ETH_BSP_Config();

	/* Initilaize the LwIP stack */
	LwIP_Init();

	/* Http webserver Init */
	httpd_init();

	/*Se inicializa la placa de expansion*/
	STM_EVAL_EXP_INIT();

	/* Infinite loop */
	while (1) {
		/* check if any packet received */
		if (ETH_CheckFrameReceived()) {
			/* process received ethernet packet */
			LwIP_Pkt_Handle();
		}
		/* handle periodic timers for LwIP */
		LwIP_Periodic_Handle(LocalTime);

		if (LocalTime % 20 == 0) {
			if (!pase1) {
				pase1 = 1;

				if (LocalTime % 100 == 0) {

					// escalera Led
					STM_EVAL_EXP_LED_TOGGLE(led);
					led++;
					if (led > 7)
						led = 0;
				}
			}
		} else {
			pase1 = 0;
		}

	}
	return 0;
}
예제 #9
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
	 */

	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

#ifdef SERIAL_DEBUG /* Configure serial debugging. */
	DebugComPort_Init();
#endif
#ifdef DEBUG
	printf("\n\rSerial Port Initialized.\n\r");
#endif

	/* Enable the PWR APB1 Clock Interface */
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

	/* Allow access to BKP Domain */
	PWR_BackupAccessCmd(ENABLE);

	if ((RTC_ReadBackupRegister(RTC_CONFIGURED_REG ) & RTC_CONFIGURED)
			!= RTC_CONFIGURED) {
#ifdef DEBUG
		printf("[Main] Configuring the RTC domain.\n\r");
#endif
		/* Initialize the RTC and Backup registers */
		/* RTC_Config(); */

		/* Setup date and time */
		/* TODO: Set up date and time */
	} else {
		/* Wait for RTC APB registers synchronization */
		RTC_WaitForSynchro();
	}

	/* Setup Watchdog debug leds */

	/**
	 * Check if the system has resumed from a WWDG reset
	 */
	if (RCC_GetFlagStatus(RCC_FLAG_IWDGRST ) != RESET) {
		/* This is a watchdog reset */

		/* Clear the reset flags */
		RCC_ClearFlag();

		/* Do any watchdog reset specific stuff here */
		/* TODO: Watchdog reset specific handling */
	} else {
		/* This is not a watchdog reset */
		/* Do any normal reset stuff here */
		if (RCC_GetFlagStatus(RCC_FLAG_SFTRST )) {
			/* Software reset */
		} else if (RCC_GetFlagStatus(RCC_FLAG_PORRST )) {
			/* Power on Reset/Power down reset */
		} else if (RCC_GetFlagStatus(RCC_FLAG_PINRST )) {
			/* Reset pin reset */
		} else {
			/* Some other reset */
		}
	}

	/* Clear the reset flags */
	RCC_ClearFlag();

	/* Initialize the Tekdaqc's peripheral hardware */
	Tekdaqc_Init();

	Init_Locator();

	if (InitializeTelnetServer() == TELNET_OK) {
		CreateCommandInterpreter();
		program_loop();
	} else {
		/* We have a fatal error */
		/* Reset the board */
		NVIC_SystemReset();
	}
	return 0;
}
예제 #10
0
int main(void)
{
	int i;		
	unsigned char add[5]={110,110,8,110,110};
  /*!< At this stage the microcontroller clock setting is already configured to 
       120 MHz, this is done through SystemInit() function which is called from
       startup file (startup_stm32f2xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f2xx.c file
     */
  
#ifdef SERIAL_DEBUG
  DebugComPort_Init();
#endif
  
	initLED();
	init_Timer();
	//while(1);
	
  /*Initialize LCD and Leds */ 
  //LCD_LED_Init();
	
	delay_ms(500);				
	
	for(i=0;i<100;i++)
	{
		setNumber(i);
		delay_ms(10);				
	}
	beep(40);
	offSegment(3);
	delay_ms(100);
	setNumber(0);
	delay_ms(100);
	beep(40);
	offSegment(3);
	delay_ms(100);
	setNumber(0);
	delay_ms(100);
	beep(40);
	
	//USART2_Init();
	//USART3_Init();
	
	init_NRF1_IO();
	init_NRF2_IO();
	SPI1_Config();
	SPI3_Config();
	SPI_Cmd(SPI1, ENABLE);
	SPI_Cmd(SPI3, ENABLE);
	
  nrf24l01_initialize_debug(false, TX_PAYLOAD_SIZE, false);
	nrf24l01_clear_flush();
	add[2]=8;
	nrf24l01_set_tx_addr(add , 5);
	add[2]=30;
	nrf24l01_set_rx_addr(add,5,0);
	nrf24l01_set_rf_ch(tx_channel);


	nrf24l02_initialize_debug(false, RX_PAYLOAD_SIZE, false);	
 	nrf24l02_clear_flush();
	add[2]=8;
	nrf24l02_set_tx_addr(add , 5);
	add[2]=30;
	nrf24l02_set_rx_addr(add,5,0);	
	nrf24l02_set_rf_ch(rx_channel);
	nrf24l02_set_as_rx(true);		
	
  /* configure ethernet */ 
  ETH_BSP_Config();
    
  /* Initilaize the LwIP stack */
  LwIP_Init();
  
  /* UDP echoserver */
  udp_echoserver_init();
  
    
  /* Infinite loop */
  while (1)
  {  
    /* check if any packet received */
					
    if (ETH_CheckFrameReceived())
    {
      /* process received ethernet packet */
      LwIP_Pkt_Handle();
    }
    /* handle periodic timers for LwIP */
    LwIP_Periodic_Handle(LocalTime);
		
		process_incoming_rf();
		
		if(firstPacketRecieved==0)
		{
			demo();
			setNumber(22);			
		}
							
  }   
}