当前位置: 首页>>代码示例>>C++>>正文


C++ ETS_GPIO_INTR_DISABLE函数代码示例

本文整理汇总了C++中ETS_GPIO_INTR_DISABLE函数的典型用法代码示例。如果您正苦于以下问题:C++ ETS_GPIO_INTR_DISABLE函数的具体用法?C++ ETS_GPIO_INTR_DISABLE怎么用?C++ ETS_GPIO_INTR_DISABLE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ETS_GPIO_INTR_DISABLE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: flowTimerCb

static void ICACHE_FLASH_ATTR flowTimerCb(void) { // 1 second

	if (flowOverridden) {
		ETS_GPIO_INTR_DISABLE();
		flowCount = 0;
		ETS_GPIO_INTR_ENABLE();
	} else {
		ETS_GPIO_INTR_DISABLE();
		oneSecFlowCount = flowCount;
		flowCount = 0;
		ETS_GPIO_INTR_ENABLE();
	}

	flowSetAverage(oneSecFlowCount);
	if (flowAverage == 0) { // Use average to deal with any timing issues when demand oscillates
		INFOP("!");
		secondsNotFlowingCount++;
	} else {
		INFOP(">");
		secondsNotFlowingCount = 0;
	}
	flowCountPerReading += oneSecFlowCount;
	if (oneSecFlowCount < flowMin) {
		flowMin = oneSecFlowCount;
	}
	if (oneSecFlowCount > flowMax) {
		flowMax = oneSecFlowCount;
	}
	calcFlows();
}
开发者ID:Daven005,项目名称:ESP8266,代码行数:30,代码来源:flowMonitor.c

示例2: button_press

void ICACHE_FLASH_ATTR
button_press() {
	ETS_GPIO_INTR_DISABLE(); // Disable gpio interrupts

	// Button interrupt received
	INFO("BUTTON: Button pressed\r\n");

	// Button pressed, flip switch
	if (GPIO_REG_READ(BUTTON_GPIO) & BIT2) {
		INFO("BUTTON: Switch off\r\n");
		GPIO_OUTPUT_SET(SWITCH03_GPIO, 0);
	} else  {
		INFO("BUTTON: Switch on\r\n");
		GPIO_OUTPUT_SET(SWITCH03_GPIO, 1);
	}

	// Send new status to the MQTT broker
	char *json_buf = NULL;
	json_buf = (char *)os_zalloc(jsonSize);
	json_ws_send((struct jsontree_value *)&device_tree, "device", json_buf);
	INFO("BUTTON: Sending current switch status\r\n");
	MQTT_Publish(&mqttClient, config.mqtt_topic_s01, json_buf, strlen(json_buf), 0, 0);
	os_free(json_buf);
	json_buf = NULL;

	// Debounce
	os_delay_us(200000);

	// Clear interrupt status
	uint32 gpio_status;
	gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
	GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status);

	ETS_GPIO_INTR_ENABLE(); // Enable gpio interrupts
}
开发者ID:felipeacorsi,项目名称:home-assistant_esp8266_mqtt,代码行数:35,代码来源:user_main.c

示例3: i2c_master_gpio_init

/******************************************************************************
 * FunctionName : i2c_master_gpio_init
 * Description  : config SDA and SCL gpio to open-drain output mode,
 *                mux and gpio num defined in i2c_master.h
 * Parameters   : NONE
 * Returns      : NONE
*******************************************************************************/
void ICACHE_FLASH_ATTR
i2c_master_gpio_init(uint8 scl, uint8 sda, uint32 bitrate)
{
    pinSCL = scl;
    pinSDA = sda;

#if 0
    ETS_GPIO_INTR_DISABLE();
//    ETS_INTR_LOCK();

    // Assume the pin mux is set before calling this function
    //PIN_FUNC_SELECT(I2C_MASTER_SDA_MUX, I2C_MASTER_SDA_FUNC);
    //PIN_FUNC_SELECT(I2C_MASTER_SCL_MUX, I2C_MASTER_SCL_FUNC);

    GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(sda)),
        GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(sda))) |
        GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)); //open drain;
    GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS,
        GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << sda));

    GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(scl)),
        GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(scl))) |
        GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)); //open drain;
    GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS,
        GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << scl));

    I2C_MASTER_SDA_SCL(1, 1);

    ETS_GPIO_INTR_ENABLE() ;
//    ETS_INTR_UNLOCK();
#endif

    I2C_MASTER_SDA_SCL(1, 1);
    i2c_master_init();
}
开发者ID:nkolban,项目名称:Espruino,代码行数:42,代码来源:i2c_master.c

示例4: spi

static void spi(uint8 c) {
	uint8 mask = 0x80;
	ETS_GPIO_INTR_DISABLE();
	while (mask != 0) {
		if (mask & c) {
//			stdoutPutchar('1');
//			easygpio_outputSet(LCD_Data, 1);
			GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, (1 << LCD_Data));
		} else {
//			stdoutPutchar('0');
//			easygpio_outputSet(LCD_Data, 0);
			GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, (1 << LCD_Data));
		}
		mask >>= 1;
		asm volatile (
			"NOP;NOP;NOP;NOP;NOP;"
		);
		GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, (1 << LCD_clk));
		asm volatile (
			"NOP;NOP;NOP;NOP;NOP;"
			"NOP;NOP;NOP;NOP;NOP;"
		);
		GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, (1 << LCD_clk));
	}
	ETS_GPIO_INTR_ENABLE();
//	stdoutPutchar(' ');
}
开发者ID:Daven005,项目名称:ESP8266,代码行数:27,代码来源:lcd_5100.c

示例5: GPIO_DIS_OUTPUT

// initialization
void IRrecv::enableIRIn() {
	
  // initialize state machine variables
  irparams.rcvstate = STATE_IDLE;
  irparams.rawlen = 0;

  // set pin modes  
  //PIN_FUNC_SELECT(IR_IN_MUX, IR_IN_FUNC);
  GPIO_DIS_OUTPUT(irparams.recvpin);
  
  // Initialize timer
  os_timer_disarm(&timer);
  os_timer_setfn(&timer, (os_timer_func_t *)read_timeout, &timer);
  
  // ESP Attach Interrupt
  ETS_GPIO_INTR_DISABLE();
  ETS_GPIO_INTR_ATTACH(gpio_intr, NULL);
  gpio_pin_intr_state_set(GPIO_ID_PIN(irparams.recvpin), GPIO_PIN_INTR_ANYEDGE);
  ETS_GPIO_INTR_ENABLE();
  //ETS_INTR_UNLOCK();  
  
  //attachInterrupt(irparams.recvpin, readIR, CHANGE);  
  //irReadTimer.initializeUs(USECPERTICK, readIR).start();
  //os_timer_arm_us(&irReadTimer, USECPERTICK, 1);
  //ets_timer_arm_new(&irReadTimer, USECPERTICK, 1, 0);
}
开发者ID:Leenix,项目名称:Tengu,代码行数:27,代码来源:IRremoteESP8266.cpp

示例6: key_init

/******************************************************************************
 * FunctionName : key_init
 * Description  : init keys
 * Parameters   : key_param *keys - keys parameter, which inited by key_init_single
 * Returns      : none
*******************************************************************************/
void ICACHE_FLASH_ATTR
key_init(struct keys_param *keys)
{
    uint8 i;
    os_printf("-%s-%s \r\n", __FILE__, __func__);

    ETS_GPIO_INTR_ATTACH(key_intr_handler, keys);

    ETS_GPIO_INTR_DISABLE();

    for (i = 0; i < keys->key_num; i++) {
        keys->single_key[i]->key_level = 1;

        PIN_FUNC_SELECT(keys->single_key[i]->gpio_name, keys->single_key[i]->gpio_func);

        gpio_output_set(0, 0, 0, GPIO_ID_PIN(keys->single_key[i]->gpio_id));

        gpio_register_set(GPIO_PIN_ADDR(keys->single_key[i]->gpio_id), GPIO_PIN_INT_TYPE_SET(GPIO_PIN_INTR_DISABLE)
                          | GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_DISABLE)
                          | GPIO_PIN_SOURCE_SET(GPIO_AS_PIN_SOURCE));

        //clear gpio14 status
        GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(keys->single_key[i]->gpio_id));

        //enable interrupt
        gpio_pin_intr_state_set(GPIO_ID_PIN(keys->single_key[i]->gpio_id), GPIO_PIN_INTR_ANYEGDE);
    }

    ETS_GPIO_INTR_ENABLE();
}
开发者ID:eeijcea,项目名称:ESP8266,代码行数:36,代码来源:key.c

示例7: easygpio_attachInterrupt

/**
 * Sets the 'gpio_pin' pin as a GPIO and sets the interrupt to trigger on that pin.
 * The 'interruptArg' is the function argument that will be sent to your interruptHandler
 */
bool ICACHE_FLASH_ATTR
easygpio_attachInterrupt(uint8_t gpio_pin, EasyGPIO_PullStatus pullStatus, void (*interruptHandler)(void *arg), void *interruptArg) {
  uint32_t gpio_name;
  uint8_t gpio_func;

  if (gpio_pin == 16) {
    os_printf("easygpio_setupInterrupt Error: GPIO16 does not have interrupts\n");
    return false;
  }
  if (!easygpio_getGPIONameFunc(gpio_pin, &gpio_name, &gpio_func) ) {
    return false;
  }

  ETS_GPIO_INTR_ATTACH(interruptHandler, interruptArg);
  ETS_GPIO_INTR_DISABLE();

  PIN_FUNC_SELECT(gpio_name, gpio_func);

  easygpio_setupPullsByName(gpio_name, pullStatus);

  // disable output
  GPIO_DIS_OUTPUT(gpio_pin);

  gpio_register_set(GPIO_PIN_ADDR(gpio_pin), GPIO_PIN_INT_TYPE_SET(GPIO_PIN_INTR_DISABLE)
                    | GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_DISABLE)
                    | GPIO_PIN_SOURCE_SET(GPIO_AS_PIN_SOURCE));

  //clear gpio14 status
  GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(gpio_pin));
  ETS_GPIO_INTR_ENABLE();

  return true;
}
开发者ID:Zhang-Jia,项目名称:ds1307-plug-demo,代码行数:37,代码来源:tisan_gpio.c

示例8: key_init

/******************************************************************************
 * FunctionName : key_init
 * Description  : init keys
 * Parameters   : key_param *keys - keys parameter, which inited by key_init_single
 * Returns	  : none
*******************************************************************************/
void ICACHE_FLASH_ATTR key_init() {
    uint8 i;

    ETS_GPIO_INTR_ATTACH(key_intr_handler, &key_parameters);

    ETS_GPIO_INTR_DISABLE();

    for (i = 0; i < key_parameters.key_num; i++) {
        key_parameters.single_key[i]->key_level = 1;
        key_parameters.single_key[i]->is_long = 0;

        PIN_FUNC_SELECT(key_parameters.single_key[i]->gpio_name, key_parameters.single_key[i]->gpio_func);

        // Set GPIO as input
        gpio_output_set(0, 0, 0, GPIO_ID_PIN(key_parameters.single_key[i]->gpio_id));

        gpio_register_set(
            GPIO_PIN_ADDR(key_parameters.single_key[i]->gpio_id),
            GPIO_PIN_INT_TYPE_SET(GPIO_PIN_INTR_DISABLE) |
            GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_DISABLE) |
            GPIO_PIN_SOURCE_SET(GPIO_AS_PIN_SOURCE)
        );

        //clear gpio14 status
        GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(key_parameters.single_key[i]->gpio_id));

        //enable interrupt
        gpio_pin_intr_state_set(GPIO_ID_PIN(key_parameters.single_key[i]->gpio_id), GPIO_PIN_INTR_NEGEDGE);
    }

    ETS_GPIO_INTR_ENABLE();
}
开发者ID:lvjh,项目名称:ESP8266,代码行数:38,代码来源:key.c

示例9: i2c_master_gpio_init

/******************************************************************************
 * FunctionName : i2c_master_gpio_init
 * Description  : config SDA and SCL gpio to open-drain output mode,
 *				mux and gpio num defined in i2c_master.h
 * Parameters   : uint8 sda and scl pin numbers
 * Returns	  : bool, true if init okay
*******************************************************************************/
bool i2c_master_gpio_init(uint8 sda, uint8 scl)
{
	if((sda > GPIO_PIN_NUM) || (pin_func[sda] == GPIO_PIN_FUNC_INVALID)){
		return false;
	}

	if((scl > GPIO_PIN_NUM) || (pin_func[scl] == GPIO_PIN_FUNC_INVALID)){
		return false;
	}

	pinSDA = sda;
	pinSCL = scl;

	ETS_GPIO_INTR_DISABLE() ;
//	ETS_INTR_LOCK();

	PIN_FUNC_SELECT(pin_mux[sda], pin_func[sda]);
	PIN_FUNC_SELECT(pin_mux[scl], pin_func[scl]);

	GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(sda)), GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(sda))) | GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)); //open drain;
	GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << sda));
	GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(scl)), GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(scl))) | GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)); //open drain;
	GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << scl));

	i2c_master_setDC(1, 1);

	ETS_GPIO_INTR_ENABLE() ;
//	ETS_INTR_UNLOCK();

	i2c_master_init();
	return true;
}
开发者ID:alemoke,项目名称:esp8266-frankenstein,代码行数:39,代码来源:i2c_master.c

示例10: i2c_init

/**
 * I2C init function
 * This sets up the GPIO io
 */
void ICACHE_FLASH_ATTR
i2c_init(void)
{
    //Disable interrupts
    ETS_GPIO_INTR_DISABLE();

    //Set pin functions
    PIN_FUNC_SELECT(I2C_SDA_MUX, I2C_SDA_FUNC);
    PIN_FUNC_SELECT(I2C_SCK_MUX, I2C_SCK_FUNC);

    //Set SDA as open drain
    GPIO_REG_WRITE(
        GPIO_PIN_ADDR(GPIO_ID_PIN(I2C_SDA_PIN)), 
        GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(I2C_SDA_PIN))) | 
        GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)
    );

    GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << I2C_SDA_PIN));

    //Set SCK as open drain
    GPIO_REG_WRITE(
        GPIO_PIN_ADDR(GPIO_ID_PIN(I2C_SCK_PIN)), 
        GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(I2C_SCK_PIN))) | 
        GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)
    );

    GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << I2C_SCK_PIN));

    //Turn interrupt back on
    ETS_GPIO_INTR_ENABLE();

    i2c_sda(1);
    i2c_sck(1);
    return;
}
开发者ID:Ignat99,项目名称:ESP8266_Relay_Board,代码行数:39,代码来源:i2c.c

示例11: set_gpio_no_interrupt

/*
 * Set GPIO mode to output. Optionally in RAM helper because interrupts are dsabled
 */
static void NO_INTR_CODE set_gpio_no_interrupt(uint8 pin, uint8_t push_pull) {
  unsigned pnum = pin_num[pin];
  ETS_GPIO_INTR_DISABLE();
#ifdef GPIO_INTERRUPT_ENABLE
  pin_int_type[pin] = GPIO_PIN_INTR_DISABLE;
#endif
  PIN_FUNC_SELECT(pin_mux[pin], pin_func[pin]);
  //disable interrupt
  gpio_pin_intr_state_set(GPIO_ID_PIN(pnum), GPIO_PIN_INTR_DISABLE);
  //clear interrupt status
  GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(pnum));

  // configure push-pull vs open-drain
  if (push_pull) {
    GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(pnum)),
                   GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(pnum))) &
                   (~ GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)));  //disable open drain;
  } else {
    GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(pnum)),
                   GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(pnum))) |
                   GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE));      //enable open drain;
  }

  ETS_GPIO_INTR_ENABLE();
}
开发者ID:nodemcu,项目名称:nodemcu-firmware,代码行数:28,代码来源:platform.c

示例12: user_init

void ICACHE_FLASH_ATTR user_init()
{
    // Initialize the GPIO subsystem.
    //UART_init(BIT_RATE_115200, BIT_RATE_115200, 0);
    //UART_SetPrintPort(UART0);
    stdout_init();

    i2c_master_gpio_init();

    user_set_station_config();

    pcf8754_i2c_write_byte(I2C_INPUT_ADDRESS, 0);
    // =================================================
    // Initialize GPIO2 and GPIO0 as GPIO
    // =================================================
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_GPIO3);
    PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0RXD_U);

    gpio_output_set(0, 0, 0, GPIO_ID_PIN(3)); // set set gpio 0 as input

    ETS_GPIO_INTR_DISABLE();
    // Attach interrupt handle to gpio interrupts.
    ETS_GPIO_INTR_ATTACH(gpio_intr_handler, NULL);
    GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(3)); // clear gpio status
    gpio_pin_intr_state_set(GPIO_ID_PIN(3), GPIO_PIN_INTR_ANYEDGE); // clear gpio status.
    ETS_GPIO_INTR_ENABLE(); // Enable interrupts by GPIO


	// register a callback function to let user code know that system
	// initialization is complete
	system_init_done_cb(&post_user_init_func);

    //Start os task
    system_os_task(user_procTask, user_procTaskPrio,user_procTaskQueue, user_procTaskQueueLen);
}
开发者ID:12019,项目名称:esp8266-samplecode,代码行数:35,代码来源:user_main.c

示例13: supla_esp_gpio_init_led

void  supla_esp_gpio_init_led(void) {

	ETS_GPIO_INTR_DISABLE();

	#ifdef LED_RED_PORT
		#if LED_RED_PORT != 16
			GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(LED_RED_PORT));
			gpio_pin_intr_state_set(GPIO_ID_PIN(LED_RED_PORT), GPIO_PIN_INTR_DISABLE);
			gpio_output_set(0, GPIO_ID_PIN(LED_RED_PORT), GPIO_ID_PIN(LED_RED_PORT), 0);
		#endif
	#endif

	#ifdef LED_GREEN_PORT
		GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(LED_GREEN_PORT));
		gpio_pin_intr_state_set(GPIO_ID_PIN(LED_GREEN_PORT), GPIO_PIN_INTR_DISABLE);
		gpio_output_set(0, GPIO_ID_PIN(LED_GREEN_PORT), GPIO_ID_PIN(LED_GREEN_PORT), 0);
	#endif

	#ifdef LED_BLUE_PORT
		GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(LED_BLUE_PORT));
		gpio_pin_intr_state_set(GPIO_ID_PIN(LED_BLUE_PORT), GPIO_PIN_INTR_DISABLE);
		gpio_output_set(0, GPIO_ID_PIN(LED_BLUE_PORT), GPIO_ID_PIN(LED_BLUE_PORT), 0);
	#endif

    ETS_GPIO_INTR_ENABLE();

}
开发者ID:SUPLA,项目名称:supla-core,代码行数:27,代码来源:supla_esp_gpio.c

示例14: disable_interrupt

void ICACHE_FLASH_ATTR disable_interrupt(){
	if(interrupt_set){
		uart0_sendStr("disable interrupt\n");
		//disable interrupt if it is enabled
		ETS_GPIO_INTR_DISABLE();

		interrupt_set=0;
	}
}
开发者ID:na1pir,项目名称:as3935_esp8266_iot,代码行数:9,代码来源:as3935.c

示例15: init_gpio

void ICACHE_FLASH_ATTR
init_gpio(void)
{
    ETS_GPIO_INTR_DISABLE();

    gpio_init();

    PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
    PIN_PULLUP_DIS(PERIPHS_IO_MUX_GPIO2_U);
}
开发者ID:neuro-sys,项目名称:esp8266_ds18b20,代码行数:10,代码来源:user_main.c


注:本文中的ETS_GPIO_INTR_DISABLE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。