Parameter Configuration For Scene 3 - Espressif ESP8266 Technical Reference

Hide thumbs Also See for ESP8266:
Table of Contents

Advertisement

!
! Note:
If MTDI is at high level, then the return value of GPIO_INPUT_GET is 1, level = 1;
If MTDI is at low level, then the return value of GPIO_INPUT_GET is 0, level = 0.
2.3.3. Parameter Configuration for Scene 3
typedef enum {
GPIO_PIN_INTR_DISABLE = 0,
GPIO_PIN_INTR_POSEDGE = 1,
GPIO_PIN_INTR_NEGEDGE = 2,
GPIO_PIN_INTR_ANYEGDE = 3,
GPIO_PIN_INTR_LOLEVEL = 4,
GPIO_PIN_INTR_HILEVEL = 5
} GPIO_INT_TYPE;
This structure is used to configure the GPIO interrupt trigger manner. It is declared in
gpio.h.
1. Configure the MTDI to GPIO mode.
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_GPIO12);
This sentence writes 1 into bits 4-5 of PERIPHS_IO_MUX_MTDI_U register. When bits 4-5
of PERIPHS_IO_MUX_MTDI_U are set to be 1, the MTDI is configured to the GPIO mode.
2. Configure the MTDI to the input mode.
GPIO_DIS_OUTPUT(GPIO_ID_PIN(12));
3. Disable all IO interrupts.
ETS_GPIO_INTR_DISABLE();
4. Set the interrupt handler function.
ETS_GPIO_INTR_ATTACH(GPIO_INTERRUPT,NULL);
5. Configure MTDI to falling edge triggers interrupt.
gpio_pin_intr_state_set(GPIO_ID_PIN(12),GPIO_PIN_INTR_NEGEDGE);
This sentence writes 0x02 into bit[9:7] of GPIO_PIN12 register. It sets MTDI to falling edge
triggers interrupt.
! Note:
If users want to disable the MTDI interrupt function, write 0x02 into bit[9:7] of GPIO_PIN12 register.
For other interrupt triggering mode configuration, refer to 2.2 Instruction on GPIO Registers.
6. Enable the GPIO interrupt.
Espressif
11 86
!
/!
2. GPIO
2016.05

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP8266 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF