Ejemplo n.º 1
0
static void ICACHE_FLASH_ATTR procTask(os_event_t *events)
{
	CSTick( 0 );

	if (light_mode) {
		//TODO enable interrupts for i2s peripheral to get notified when transfer is finished instead of having to count
		pattern_tick(tickCount);
		tickCount++;
		if (tickCount==512) {

			pattern_update();
			
			tickCount=0;
		}

	}

	system_os_post(procTaskPrio, 0, 0 );
}
Ejemplo n.º 2
0
static void ICACHE_FLASH_ATTR
procTask(os_event_t *events)
{
	system_os_post(procTaskPrio, 0, 0 );

	CSTick( 0 );
	TickAVRSoftSPI(0);

	if( events->sig == 0 && events->par == 0 )
	{
		//Idle Event.
		struct station_config wcfg;
		char stret[256];
		char *stt = &stret[0];
		struct ip_info ipi;

		int stat = wifi_station_get_connect_status();

//		printf( "STAT: %d\n", stat );

		if( stat == STATION_WRONG_PASSWORD || stat == STATION_NO_AP_FOUND || stat == STATION_CONNECT_FAIL )
		{
			wifi_set_opmode_current( 2 );
			stt += ets_sprintf( stt, "Connection failed: %d\n", stat );
			uart0_sendStr(stret);
		}

		if( stat == STATION_GOT_IP && !printed_ip )
		{
			wifi_station_get_config( &wcfg );
			wifi_get_ip_info(0, &ipi);
			stt += ets_sprintf( stt, "STAT: %d\n", stat );
			stt += ets_sprintf( stt, "IP: %d.%d.%d.%d\n", (ipi.ip.addr>>0)&0xff,(ipi.ip.addr>>8)&0xff,(ipi.ip.addr>>16)&0xff,(ipi.ip.addr>>24)&0xff );
			stt += ets_sprintf( stt, "NM: %d.%d.%d.%d\n", (ipi.netmask.addr>>0)&0xff,(ipi.netmask.addr>>8)&0xff,(ipi.netmask.addr>>16)&0xff,(ipi.netmask.addr>>24)&0xff );
			stt += ets_sprintf( stt, "GW: %d.%d.%d.%d\n", (ipi.gw.addr>>0)&0xff,(ipi.gw.addr>>8)&0xff,(ipi.gw.addr>>16)&0xff,(ipi.gw.addr>>24)&0xff );
			stt += ets_sprintf( stt, "WCFG: /%s/%s/\n", wcfg.ssid, wcfg.password );
			uart0_sendStr(stret);
			printed_ip = 1;
		}
	}
Ejemplo n.º 3
0
//Timer event.
static void ICACHE_FLASH_ATTR myTimer(void *arg)
{
	CSTick( 1 );
}
Ejemplo n.º 4
0
static void ICACHE_FLASH_ATTR myTimer(void *arg)
{
	static int thistik;
	static int waittik;
	thistik++;

	CSTick( 0 );

//	wifi_set_user_fixed_rate( 3, 0x0b );  //0xb = 6Mbit G
//	wifi_set_user_fixed_rate( 3, 0x0c );  //0xc = 54Mbit G
//	wifi_set_user_fixed_rate( 3, 0x07 );  //0x7 = 11Mbit ... B?

	//0x02 = 5.5Mbit/s (B)
	//0x01 = 2Mbit/s (B)
	//0x00 = 1Mbit/s (B)
	//0x10 = 6.5MBit
	//0x11 = 13MBit
	//0x1f = 72.2Mbit/s
//	wifi_set_phy_mode(PHY_MODE_11N);
	wifi_set_phy_mode(PHY_MODE_11G); //??? Maybe - I haven't been doing this...

	wifi_set_user_fixed_rate( 3, 0x0c );

//	wifi_set_user_limit_rate_mask( 3 );
//	wifi_set_user_rate_limit( FIXED_RATE_MASK_ALL, 0, 1, 1 );

	if( thistik == waittik-3 )
	{
		int i;
		static int did_init = 0;

		if( !did_init && printed_ip )
		{
			//For sending raw packets.
			//SetupRawsend();
			wifi_set_raw_recv_cb( rx_func );

			wifi_register_send_pkt_freedom_cb( sent_freedom_cb );

			did_init = 1;

			//Setup our send packet with our MAC address.
			wifi_get_macaddr(STATION_IF, mypacket + 10);
			debugccount = 0;

			//printf( "!!!\n" );
		}


		//printf( "%d\n", debugccount );
		//uart0_sendStr("k");
		ets_strcpy( mypacket+30, "ESPEED" );
		txpakid++;
		mypacket[36] = txpakid>>24;
		mypacket[37] = txpakid>>16;
		mypacket[38] = txpakid>>8;
		mypacket[39] = txpakid>>0;
		mypacket[40] = 0;
		mypacket[41] = 0;
		mypacket[42] = 0;
		mypacket[43] = 0;
	
		packet_tx_time = 0;
		wifi_send_pkt_freedom( mypacket, 30 + 16, true) ;  
		//Looks like we can actually set the speed --> wifi_set_user_fixed_rate( 3, 12 );
	}
Ejemplo n.º 5
0
static void ICACHE_FLASH_ATTR procTask(os_event_t *events)
{
	CSTick( 0 );
	system_os_post(procTaskPrio, 0, 0 );
}