Beispiel #1
0
/*******************************************************************************
* Function Name  : main
* Description    : Main program.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
int main(void)
{

	RCC_Configuration(); // Configure the system clocks
	GPIO_Configuration();
	NVIC_Configuration(); // NVIC Configuration
	USART1_Init();
	Timer_Configuration();

	wizspi_init(WIZ_SPI_1);
	WIZ_Config(); // network config & Call Set_network ();

	// LED3 and LED4 On!
	LED3_onoff(ON);
	LED4_onoff(ON);

	// Start Application
	//Main_Menu();
	
	while(1) {
		ftp_client_PI(FTP_CLIENT_PI_SOCK);
		ftp_client_DTP(FTP_CLIENT_DTP_SOCK);
	}

}
Beispiel #2
0
void main(void)
{
/*--------------initialization-----------*/

  Set_System();
  NVIC_Configuration();
  GPIO_Config();
  SD_Card_Check();
  USB_Init();
  ADC_Configuration();
  Timer_Configuration();
  LCD_Initial();
  Clear_Screen(BLACK); 
  Display_Logo(110,150);  
 
/*----------Power ON Information----------*/ 

  Display_Str(80, 87, GRN,   PRN, "System Initializing");
  Display_Str(102, 71, GRN,   PRN, "Please Wait");
  Display_Str(8, 39, WHITE, PRN, "DSO FW Copyright (c) BenF 2010-2011"); 
  Display_Str(8, 23, YEL,   PRN, "LIB ver 3.13");
  
  //WaitForKey();

  // check for presence of APP and jump to start
  pApp = (APP_Interface *)*(u32 *)(APP_VECTORS + 7 * 4);
  if (pApp->Signature == APP_SIGNATURE)
      pApp->APP_Start();

  Display_Str(150, 23, RED, PRN, "No APP found");
  while (1);
}
Beispiel #3
0
/*******************************************************************************
* Function Name  : main
* Description    : Main program.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
int main(void)
{

        RCC_Configuration(); // Configure the system clocks
	GPIO_Configuration();
	NVIC_Configuration(); // NVIC Configuration
	USART1_Init();
	Timer_Configuration();
        
	WIZ_SPI_Init();	
	WIZ_Config(); // network config

        // LED3 and LED4 On!
	LED3_onoff(ON);
	LED4_onoff(ON);
        
        // Start Application         
        printf("\r\n\r\n----------------------------------- \r\n");
        printf("Twitter and DNS using W5200\r\n");  
        printf("----------------------------------- ");

	Main_Menu();

	while(1) {
	}
        
}
Beispiel #4
0
/**
  * @brief  Initialize the correspond device.
  * @param Device_Init: specifies the devices which will be initalized
  *   This parameter can be any combination of the following values:
  * @arg GPIO_INIT, RTC_INIT, USART_INIT, FLASH_INIT,
  *   FSCM_INIT, RCC_INIT
  * @retval : None
  */
void SystemResourcesInit(uint32_t Device_Init)
{
	if(Device_Init & RCC_INIT)
	{
		/* System Clocks Configuration */
		RCC_Configuration();
		//RCC_Internal_Configuration();
	}
	if(Device_Init & FSCM_INIT)
	{
		FSCM_Configuration();
	}
	if(Device_Init & FLASH_INIT)
	{
		Flash_Configuration(FALSE);
	}
	if(Device_Init & NVIC_INIT)
	{
		/* NVIC configuration */
		NVIC_Configuration();
	}
	if(Device_Init & GPIO_INIT)
	{
		/* Configure the GPIO */
		GPIO_Configuration();
	}
	if(Device_Init & USART_INIT)
	{
		/* Configure the USART */
		USARTx_Configuration();
	}
	if(Device_Init & SYSTICK_INIT)
	{
		/* SysTick Configuration */
		SysTick_Configuration();
	}
	if(Device_Init & TIMER_INIT)
	{
		/* Timer Configuration */
		Timer_Configuration();
	}
	if(Device_Init & SPI_INIT)
	{
		SPIx_Configuration();
	}
	if(Device_Init & DAC_INIT)
	{
		DAC_VOLTAGE_Configuration();
	}
	if(Device_Init & ADC_INIT)
	{
		ADC_Configuration();
	}
	
}
Beispiel #5
0
int main(int argc, char* argv[])
{
	int ret;

	RCC_Configuration();
	
	LED_Init(LED1);
	LED_Init(LED2);
	
	LED_On(LED1);
	LED_Off(LED2);

	BOOT_Pin_Init();

	USART1_Configuration();

#if defined(MULTIFLASH_ENABLE)
	probe_flash();
#endif

	/* Load Configure Infomation */
	load_S2E_Packet_from_storage();

	/* Check MAC Address */
	check_mac_address();

	W5500_SPI_Init();
	W5500_Init();
	Timer_Configuration();

	Net_Conf();
	TFTP_init(SOCK_TFTP, socket_buf);

	ret = application_update();

	if((get_bootpin_Status() == 0) && (ret != TFTP_FAIL)) {
		uint32_t tmp;

#if !defined(MULTIFLASH_ENABLE)
		tmp = *(volatile uint32_t *)APP_BASE;
#else
		tmp = *(volatile uint32_t *)flash.flash_app_base;
#endif

		if((tmp & 0xffffffff) != 0xffffffff) {
			application_jump();
		}
	}

	while (1) {
		do_udp_config(SOCK_CONFIG);
	}
}
Beispiel #6
0
int main(void)
{
    /* System Clocks Configuration */
	RCC_Configuration();

	/* NVIC configuration */
	NVIC_Configuration();

	/* GPIO configuration */
	GPIO_Configuration();

	SysTick_Configuration();

	Timer_Configuration();

	dxl_initialize( 0, 1 );
	USART_Configuration(USART_PC, Baudrate_PC);

	while(1)
	{
		bMoving = dxl_read_byte( id, P_MOVING );
		CommStatus = dxl_get_result();
		if( CommStatus == COMM_RXSUCCESS )
		{
			if( bMoving == 0 )
			{
				// Change goal position
				if( INDEX == 0 )
					INDEX = 1;
				else
					INDEX = 0;

				// Write goal position
				dxl_write_word( id, P_GOAL_POSITION_L, GoalPos[INDEX] );
			}

			PrintErrorCode();

			// Read present position
			wPresentPos = dxl_read_word( id, P_PRESENT_POSITION_L );
			TxDWord16(GoalPos[INDEX]);
			TxDString("   ");
			TxDWord16(wPresentPos);
			TxDByte_PC('\r');
			TxDByte_PC('\n');
		}
		else
			PrintCommStatus(CommStatus);

	}
	return 0;
}
Beispiel #7
0
void main()
{
  
  RCC_Configuration(); // Configure the system clocks
  GPIO_Configuration(); //GPIO configuration
  NVIC_Configuration(); //NVIC Configuration
  Timer_Configuration();
  
  iic_init();
  //ov2640_jpeg_config(JPEG_800x600);
 
  ov2640_jpeg_config(JPEG_640x480);
  
  //ov2640_jpeg_config(JPEG_320x240);
   /* 设置COMS参数 */
   ov2640_brightness_config(0x40);
   ov2640_auto_exposure(3);//3
   ov2640_contrast_config(0x28, 0x0c);
   ov2640_black_white_config(0x00);
   ov2640_color_saturation(0x68, 0x68);
    ov2640_light_mode_config(OFFICE);
   o2640_capture_gpio_init();

   /* 关闭像素同步中断 */
  ov2640_interrupt_disable();
  USART1_Init(); //115200@8-n-1
  //UART4_Init(38400);//camera
  printf("MCU initialized.\r\n");
  Reset_W5500();
  printf("Ethernet initialized over.\r\n");
  WIZ_SPI_Init();
  
  set_network();
  
  printf("W5500 is ready!\r\n");
  
  printf("camera init......OK\r\n");
  
  JPEGCnt=0;
  ov2640_interrupt_enable();
  
  while(1)
  {
    do_websocket_server(SOCK_WEBSOCKET);
    
    do_http();
    
  }
}
Beispiel #8
0
void Platform_Init(void)
{
    RCC_Configuration();
    GPIO_Configuration();
    NVIC_Configuration();
	Timer_Configuration();
	USART_Configuration();			  
	EXTI_Configuration();
    delay_init(72);

	RS485_1_RX;				 //RS485 receive mode
	RS485_2_RX;				 //RS485 receive mode
   
//	IWDG_Configuration(781); //初始化独立看门狗5s

}
Beispiel #9
0
/*******************************************************************************
* Function Name  : main
* Description    : Main program.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
int main(void)
{
    u8 res=0;
	delay_init();
    RCC_Configuration();  // Configure the system clocks
    NVIC_Configuration(); // NVIC Configuration
    GPIO_Configuration();
	
//    USART3_Configuration();	
    USART1_Configuration();
	
    Timer_Configuration();
	LED_GPIO_Configuration();
  	LED1_ON;;		

    Reset_W5500();
    WIZ_SPI_Init();

    ZC_Init();
    WIZ_Config(); // network config & Call Set_network ();
    Get_ChipInfo();
    presentTime = my_time; // For TCP client's connection request delay
    // Start Application
    printf("\r\n\r\n------------------------------------------- \r\n");
    printf("Loopback using W5500\r\n");  
    printf("------------------------------------------- ");
//    AC_ConfigWifi();

 do{
    res = Dhcp_Task();
    }while(res!=0);
    
   HF_WakeUp();
    while(1)
    {
     
      HF_Cloudfunc();
      
    }

}
void System_Configuration(void)
{

	__disable_interrupt();
	/* System Clocks Configuration */
	RCC_Configuration();
	   
	/* NVIC configuration */
	NVIC_Configuration();


	/* Configure the GPIO ports */
	GPIO_Configuration();



	/* Unlock the Flash Program Erase controller */
	FLASH_Unlock();

	/* USART Configuration */
	USART_Configuration(USART_DXL,Baudrate_DXL);
	//dxl_initialize(USART_DXL,Baudrate_DXL);
	zgb_initialize(0);
	//USART_Configuration(USART_ZIGBEE,Baudrate_ZIGBEE);

	//USART_Configuration(USART_PC,1000000);
	//USART_Configuration(USART_PC,3000000);
	USART_Configuration(USART_PC,Baudrate_PC);


	/* ADC Configuration */
	ADC_Configuration();
	
	

	SysTick_Configuration();
	
	Timer_Configuration();


	SPI_Configuration();

	Buzzer_Configuration();


	GPIO_ResetBits(PORT_ENABLE_TXD, PIN_ENABLE_TXD);	// TX Disable
	GPIO_SetBits(PORT_ENABLE_RXD, PIN_ENABLE_RXD);	// RX Enable
	GPIO_SetBits(PORT_SIG_ACC_CS,PIN_SIG_ACC_CS);
	GPIO_SetBits(PORT_SIG_GYRO_CS,PIN_SIG_GYRO_CS);

	__enable_interrupt();



	Gyro_Configuration();
	ACC_Configuration();






}
Beispiel #11
0
/*******************************************************************************
* Function Name  : main
* Description    : Main program.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
int main(void)
{  
	uint16 i; 
        RCC_Configuration(); // Configure the system clocks
	NVIC_Configuration(); // NVIC Configuration
	GPIO_Configuration();
	USART1_Init(115200);
	Timer_Configuration();
        
        printf("============================================\r\n");
	printf("   HTTP client for W5200 \r\n");
	printf("============================================\r\n");
       
	WIZ_SPI_Init();	
        Reset_W5200();
        wizInit();
        InitNetInfo();
        DisplayNetInfo();
	              
        // LED3 and LED4 On!
	LED3_onoff(ON);
	LED4_onoff(ON);
     
       
        uint8  url[MAX_URL_SIZE];			//full url
	uint8  url_dn[MAX_URL_SIZE];			//domain name url
	uint8  url_path[MAX_URL_SIZE];		//local path in html server
	char * split;				//string split pointer 
	
	
	uint16 done_http = 0;
	uint16 start_idx = 0 ;
	uint16 end_idx = 0;
	uint16 tmp_start;
	uint16 tmp_end;
	uint8 BR [4]= "<BR>";
	uint8 rBR [4]= "\r\n";
	uint8 TITLE [7]= "<TITLE>";
	uint8 bTITLE [8]= "</TITLE>";
	

	uint16 tmp_idx;
	uint8 no_pr = 0;
	uint8 str[17];
       
	
            while (1)
            {
                          
              sprintf((char*)str,"%.3d.%.3d.%.3d.%.3d ",
				IINCHIP_READ (SIPR0+0), IINCHIP_READ (SIPR0+1), 
				IINCHIP_READ (SIPR0+2), IINCHIP_READ (SIPR0+3));
                            
                           
                            /* Get Http Address  */
                            printf("\r\n Please enter a HTTP Address without 'http://' \n\r"); 
                            printf("http://");
                            memset(url,0,sizeof(url));	
                            //Modified by Gang 2011-10-04
                            zScanf_s(1, url);
                            printf("\r\n Your HTTP address is: %s \r\n",url);		
                            
                            /* Parse URL Path  */
                            split = strchr((char const*)url,'/');			
                            strcpy((char*)url_path,split); 			
                            printf("Domain path: %s \r\n",url_path);
                    
                            /* Parse URL Domain  */
                            split = strtok((char*)url,"/");			
                            strcpy((char*)url_dn,split);				
                            printf("Domain name: %s \r\n",url_dn);
                            
               
                            /* Do DNS Client */
                            memset(httpclient_NetInfo.HTTPs_IP,0,sizeof(httpclient_NetInfo.HTTPs_IP));
                            //Delay_ms(10);
                            done_dns = dns_query(DNS_SOCK, url_dn, httpclient_NetInfo.HTTPs_IP);
                            printf("\r\n HTTPs_IP= %d.%d.%d.%d",httpclient_NetInfo.HTTPs_IP[0],httpclient_NetInfo.HTTPs_IP[1],httpclient_NetInfo.HTTPs_IP[2],httpclient_NetInfo.HTTPs_IP[3]);
                          
                            while(done_dns) {
                            
                            /* Do HTTP Client */
                            done_http = http_client(HTTPC_SOCK, httpclient_NetInfo.HTTPs_IP, url_path, url_dn,data_buf);
                           
                            if(done_http) { // on success, done_dns is not  '0'
                                            
    #define Recieved_DATA
    #ifdef Recieved_DATA
                                            printf("\r\n<< Recieved Data -- START>> \r\n");
                                           
                                            for(i=0; i<done_http; i++){
                                                  
                                                  printf("%c",(uint8)data_buf[i]);
                                              }   
                                            printf("\r\n");
                                            printf("<< Recieved Data -- END>> \r\n");
                                           
    #endif
                                        /* parsed index */
                                            //All other HTML elements are nested between the opening <html> and </html> tags.
                                            start_idx = pased_idx((uint8 *)str_start , sizeof(str_start), done_http );
                                            end_idx   = pased_idx((uint8 *)str_end , sizeof(str_end), done_http );			
    
                                            /* printf get <html> ...</html> */							
                                            for(i=start_idx; i<(end_idx+7); i++){						
                                                    /* remove header */
                                                    data_buf[i-start_idx] = data_buf[i];
                                             }   
                                            printf("\r\n");
                                            
    
                                            /* replace <br> tag to \r\n */
                                            //The br tag is used for specifying a line break.
                                            do{
                                                    tmp_idx = pased_idx((uint8*)BR, sizeof(BR) , end_idx-start_idx) ;
                                                    if(tmp_idx == 0 ) 
                                                            break;
                                                 
                                                    memcpy((uint8 *)data_buf+tmp_idx, (uint8*)rBR, sizeof(rBR)) ;
                                            }while(tmp_idx!=end_idx-start_idx);
    
    #define Parsed_DATA
    #ifdef Parsed_DATA
                                            /* parsed DATA */
                                            printf("\r\n<< Parsed Data -- START >>");
                                            printf("\r\nTITLE : \r\n");
                                            /* parse <TITLE> and </TITLE> tags */
                                            tmp_start = pased_idx((uint8 *)TITLE , sizeof(TITLE),(end_idx-start_idx) ) + sizeof(TITLE);
                                            tmp_end   = pased_idx((uint8 *)bTITLE , sizeof(bTITLE),(end_idx-start_idx) );												
                                            for(i=tmp_start; i<tmp_end; i++){
                                                   
                                                    printf("%c",(uint8)data_buf[i]); // printf title
                                            }   
    
                                            printf("\r\n BODY : \r\n");
                                            /*DO NOT PRINT TAG COMMAND: between '<' with '>' */
                                            for(i=tmp_end; i<(end_idx-start_idx); i++){
                                                    //Tag command - ex.)<PRE>
                                                    //'<' is a start point of tag command.
                                                    if((uint8)data_buf[i]=='<'){ 
                                                            no_pr = 0;
                                                    }
                                                    //'>' is a end point of Tag command.
                                                    //To avoid in row tags -> ex.) <PRE><H1>						
                                                    if((uint8)data_buf[i]=='>' && (uint8)data_buf[i+1] !='<' ) {
                                                            no_pr = 1;
                                                            i++;
                                                    }					
                                                    if(no_pr){
                                                        Delay_ms(1);    
                                                        printf("%c",(uint8)data_buf[i]);
                                                    }
                                            }   
                                            printf("\r\n<< Parsed Data -- END >>\r\n");
    #endif
                                            /* Init. parameter */
                                            start_idx= 0;
                                            end_idx= 0;				
                                    done_dns = 0;  
                                    break;
    
                            }
                           //done_http
                            //done_dns=0;
                    }//while : done_dns == 1		
            }
}