Пример #1
0
void ICACHE_FLASH_ATTR user_plug_init() {
	uint8 i;
	
	for (i=0; i<PLUG_LED_COUNT; i++) {
		PIN_FUNC_SELECT(plug_led_hardware[i].gpio_name, plug_led_hardware[i].gpio_func);
	}
	PIN_FUNC_SELECT(plug_reset_hardware.gpio_name, plug_reset_hardware.gpio_func);
	
	plug_init();
	plug_wifi_blink_start();
}
Пример #2
0
LOCAL void ICACHE_FLASH_ATTR user_event_wifi(System_Event_t *evt) {
	switch (evt->event) {
		case EVENT_STAMODE_CONNECTED:
		break;
		
		case EVENT_STAMODE_DISCONNECTED:
// TODO - register callbacks to break module/device dependency
#if DEVICE == BADGE
			badge_wifi_animation_start();
#endif
#if DEVICE == PLUG
			plug_wifi_blink_start();
#endif
			wifi_auto_detect();
		break;
		
		case EVENT_STAMODE_AUTHMODE_CHANGE:
		break;
		
		case EVENT_STAMODE_DHCP_TIMEOUT:
		break;
		
		case EVENT_STAMODE_GOT_IP:
// TODO - register callbacks to break module/device dependency
#if DEVICE == BADGE
			badge_wifi_animation_stop();
#endif
#if DEVICE == PLUG
			plug_wifi_blink_stop();
#endif
			user_event_connect();
		break;
		
		case EVENT_SOFTAPMODE_STACONNECTED:
		break;
		
		case EVENT_SOFTAPMODE_STADISCONNECTED:
		break;
	}
}