예제 #1
0
void user_init(void)
{

     supla_log(LOG_DEBUG, "Starting");

     wifi_status_led_uninstall();

     supla_esp_cfg_init();
     supla_esp_devconn_init();
     supla_esp_gpio_init();

     if ( supla_esp_cfg.LocationID == 0
    		 || supla_esp_cfg.LocationPwd[0] == 0
    		 || supla_esp_cfg.Server[0] == 0
    		 || supla_esp_cfg.WIFI_PWD[0] == 0
    		 || supla_esp_cfg.WIFI_SSID[0] == 0 ) {

    	 supla_esp_cfgmode_start();
    	 return;
     }


    supla_esp_devconn_start();

}
예제 #2
0
void ICACHE_FLASH_ATTR disable_wifi2_status_led(const int8_t cid, const DisableWifi2StatusLED *data) {
	if(wifi2_status_led_enabled) {
		wifi_status_led_uninstall();
		gpio_output_set(BIT12, 0, BIT12, 0);
		wifi2_status_led_enabled = false;
	}
	com_return_setter(cid, data);
}
예제 #3
0
파일: led.c 프로젝트: icamgo/noduino-sdk
irom void wifi_led_disable()
{
	wifi_status_led_uninstall();
}
// pinMode([pin], [direction])
void ICACHE_FLASH_ATTR
at_setupPinModeCmd(uint8_t id, char *pPara)
{
    int result = 0, err = 0, flag = 0;
    uint8 buffer[32] = {0};
    pPara++; // skip '='

    //get the first parameter (uint8_t)
    // digit
    flag = at_get_next_int_dec(&pPara, &result, &err);

    // flag must be true because there are more parameters
    if ((flag == FALSE) && (result > 0) )
	{
        at_response_error();
        return;
    }
	
	uint8_t pin = result;
	
	// Don't go any further if the pin is un-usable or non-existant
	if (!pinValid(pin))
	{
		at_response_error();
		return;
	}
	
	if (*pPara++ != ',') { // skip ','
		at_response_error();
		return;
	}
	
	char mode = *pPara++;
	
	if ((mode == 'i') || (mode == 'I'))
	{
		if (pin == STATUS_LED_PIN)
		{
			wifi_status_led_uninstall();
		}
		PIN_FUNC_SELECT(pinMap[pin], pinFunction[pin]);
		GPIO_DIS_OUTPUT(pin);
		PIN_PULLUP_DIS(pinMap[pin]);
		os_sprintf(buffer, "%d=INPUT\r\n", pin);
	}
	else if ((mode == 'o') || (mode == 'O'))
	{
		if (pin == STATUS_LED_PIN)
		{
			wifi_status_led_uninstall();
		}
		PIN_FUNC_SELECT(pinMap[pin], pinFunction[pin]);
		GPIO_OUTPUT_SET(pin, 0);
		os_sprintf(buffer, "%d=OUTPUT\r\n", pin);
	}
	else if ((mode == 'p') || (mode == 'P'))
	{
		if (pin == STATUS_LED_PIN)
		{
			wifi_status_led_uninstall();
		}
		PIN_FUNC_SELECT(pinMap[pin], pinFunction[pin]);
		GPIO_DIS_OUTPUT(pin);
		PIN_PULLUP_EN(pinMap[pin]);
		os_sprintf(buffer, "%d=INPUT_PULLUP\r\n", pin);
	}
	else
	{
		at_response_error();
		return;
	}
	
	at_port_print(buffer);
	at_response_ok();
}
예제 #5
0
void ICACHE_FLASH_ATTR wifi_led_disable()
{
	wifi_status_led_uninstall();
}