Ejemplo n.º 1
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int wifi_main(void)
{	unsigned char i;
    SysTick_Configuration();
//    DBGU_Init();
    SN8200_API_Init(921600);
	
    strcpy(domain, "www.murata-ws.com");
    strcpy(uri, "/index.html");
    printf("\n\rHello, Embedded World!\n\r");
    printf("\n\r");
    WifiOn(seqNo++);
    printf("\n\r");
    
    ShowMenu();
	
	WifiDisconn(seqNo++);
        WifiJoin(seqNo++);
        SnicInit(seqNo++);
        SnicIPConfig(seqNo++);
    /* Infinite loop */
    while (1) {
        if(DBGU_InputReady) {
            ProcessUserInput();
        }
        if(SN8200_API_HasInput()) {
            ProcessSN8200Input();
        }
        if(quit_flag)
            break;
    }
    printf("\n\rGoodbye, Embedded World!\n\r");
		
		
}void DBGU_Init(void)
Ejemplo n.º 2
0
void	WiFi(void) {

static 
void	(*f)(void)=NULL;	
static 
int		fo=true;

			if(f==NULL) {
				DbgPrint(NULL);
				Dbg=_buffer_init(128);
				SN8200_API_Init(921600);
				strcpy(domain, "www.murata-ws.com");
				strcpy(uri, "/index.html");	
				if(!__com0 || !Dbg)
					NVIC_SystemReset();
				else {
					f=App_Loop;
					App_Loop=WiFi;
					SnicCleanup(seqNo++);
					WifiOff(seqNo++);
					Wait(200,App_Loop);
					WifiOn(seqNo++);
					Wait(200,App_Loop);
	        SnicInit(seqNo++);
					Wait(200,App_Loop);
					GetStatus(seqNo++);
					Wait(200,App_Loop);
					_buffer_push(Dbg,"0\r",2);	
					SnicGetDhcp(seqNo++);
					_buffer_push(Dbg,"6000\r",5);
					while (setTCPinfo() == CMD_ERROR)
						Wait(200,App_Loop); 
					mysock = -1;
					tcpCreateSocket(1, srcIP, (unsigned short)srcPort, seqNo++, SNIC_TCP_CREATE_SOCKET_REQ);
					if (mysock != -1) {
						tcpCreateConnection(mysock, TEST_BUFFERSIZE, 0x5, seqNo++);
					}
				}
			} else {
				__sendFromSock();
				if(fo==true) {
					fo=false;
					fo=ProcessUserInput();
				}
				if(SN8200_API_HasInput())
					ProcessSN8200Input();	
				f();
			}
}