Пример #1
0
int main(void) {
    int temp = 5;
    //configures the priority grouping
    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3);
    //start time
    start_timer();
    //configure spi
    SPI_Config();
    //ETHERNET INITIALIZATION
    ETH_BSP_Config();
    /* Initilaize the LwIP stack */
    LwIP_Init();
    //udp initialization
    if (!udp_echoserver_init())
        return 1;
    while (1)
    {
        //PROCESSING OF PEREODIC TIMERS FOR LWIP
        LwIP_Periodic_Handle(gettime());
        //PROCESSING OF INCOMING PACKET
        if (ETH_CheckFrameReceived())
        {
            /* process received ethernet packet */
            LwIP_Pkt_Handle();
        }
        trans_Control((void*)&temp, sizeof(temp));
    }
}
Пример #2
0
int main(void) {
	struct b_pool* pbuf;
	struct head* h;
	init_pools_buffers();
	//configure NVIC
	NVIC_Configuration();
	//start time
	start_timer();
	//configure adc
	ADC_config();
	//configure pwm
	pwm_Config();
	//ETHERNET INITIALIZATION
	ETH_BSP_Config();
	/* Initilaize the LwIP stack */
  LwIP_Init();
	//enable clock
	/*__disable_irq();
	clockHseInit();
	__enable_irq();*/
	/*Initilaize the PTP stack*/
	PTPd_Init();
	//udp initialization
	udp_echoserver_init();
	//configure state
	//init_current_state(&cur);
	cur.status = STOP;
	cur.id_sig = 0;
  while (1)
  {  
    //PROCESSING OF PEREODIC TASKS FOR LWIP
    LwIP_Periodic_Handle(gettime());
		//PROCESSING OF PEREODIC TASKS FOR PTP
		ptpd_Periodic_Handle(gettime());
		//PROCESSING OF QUEUING BUFFERS
		pbuf = pull_out_queue();
		if(pbuf != NULL) {
			h = (struct head*)pbuf->pbuf;
			if(h->dst & SLAVE) {
				if(h->type == COMMAND)
					handl_command(pbuf);
			} else
				transPackage(pbuf, eth_write);
			free_buf(pbuf);
		}
		//PROCESSING OF DEBUG_INFO
		if(debug.time > 0) {
			if(debug.num == -1 || debug.num > 0)  {
				debug_info();
			}
			else
				debug.time = 0;
			if (debug.num > 0)
				debug.num --;
		}
		//PROCESSING OF TEMP BUFFER
		
  }   
}
Пример #3
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* Enable the CPU Cache */
  CPU_CACHE_Enable();

  /* STM32F7xx HAL library initialization:
       - Configure the Flash ART accelerator on ITCM interface
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Global MSP (MCU Support Package) initialization
     */
  HAL_Init();  
  
  /* Configure the system clock to 200 MHz */
  SystemClock_Config(); 
  
  /* Configure the BSP */
  BSP_Config();
    
  /* Initialize the LwIP stack */
  lwip_init();
  
  /* Configure the Network interface */
  Netif_Config();
  
  /* tcp echo server Init */
  udp_echoserver_init();
  
  /* Notify user about the network interface config */
  User_notification(&gnetif);
  
  /* Infinite loop */
  while (1)
  {  
    /* Read a received packet from the Ethernet buffers and send it 
       to the lwIP for handling */
    ethernetif_input(&gnetif);

    /* Handle timeouts */
    sys_check_timeouts();
  }
}
Пример #4
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
  DebugComPort_Init();
#endif

  /*Initialize LCD and Leds */ 
  LCD_LED_Init();

  /* 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);
  } 
}
Пример #5
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Global MSP (MCU Support Package) initialization
     */
  HAL_Init();  
  
  /* Configure the system clock to have a system clock = 168 Mhz */
  SystemClock_Config();
  
  /* Configure the BSP */
  BSP_Config();
    
  /* Initilaize the LwIP stack */
  lwip_init();
  
  /* Configure the Network interface */
  Netif_Config();  
  
  /* tcp echo server Init */
  udp_echoserver_init();
  
  /* Notify user about the netwoek interface config */
  User_notification(&gnetif);

  /* Infinite loop */
  while (1)
  {  
    /* Read a received packet from the Ethernet buffers and send it 
       to the lwIP for handling */
    ethernetif_input(&gnetif);

    /* Handle timeouts */
    sys_check_timeouts();
  }
}
Пример #6
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);			
		}
							
  }   
}