//GPIO FUNCTIONS #defineINPUT0x00 //输入 #defineINPUT_PULLUP0x02 //上拉输入 #defineINPUT_PULLDOWN_160x04// PULLDOWN only possible for pin16下拉输入仅适用于PIN16脚 #defineOUTPUT0x01 //输出 #defineOUTPUT_OPEN_DRAIN0x03 //开漏输出 #
OUTPUT_OPEN_DRAIN_PULL_UP, /* Output, actively driven low. When set high, is pulled high with an internal resistor */ OUTPUT_OPEN_DRAIN_NO_PULL, /* Output, actively driven low. When set high, is high-impedance */ INPUT_PULL_DOWN, /* Input, with an internal pull-down resistor */ ...
i2c_master.c #include "ets_sys.h" #include "osapi.h" #include "gpio.h" #include "driver/i2c_master.h" /*** * FunctionName : i2c_master_setDC * Description : Internal used function - * set i2c SDA and SCL bit value for half clk cycle * Parameters : uint8 SDA * uint8 SCL *...
gpio_config_t io_conf;/* disable interrupt */io_conf.GPIO_IntrType = GPIO_PIN_INTR_DISABLE;/* set mode */if(gpio->config == OUTPUT_PUSH_PULL) { io_conf.GPIO_Mode = GPIO_Mode_Output; }elseif((gpio->config == OUTPUT_OPEN_DRAIN_NO_PULL) || (gpio->config == OUTPUT_OPEN_DRAIN...
allow to set pin to OUTPUT_OPEN_DRAIN in analogWriteMode (#7841) Add 24-bit mode to I2S (#7835) Hexdump fix&update (#7831) improve silicon aes_unwrap (#7773) Supersede #3856, remove undef min/max (#7824) Add stub for analogReference() (#7809) UART: add yield (#7799) BREAKING - ...
#include<esp8266wifi.h>voidsetup(){WiFi.forceSleepBegin();// turn off ESP8266 RFdelay(1);// give RF section time to shutdownSerial.begin(115200);Serial.println(F("ESP8266 in No-RF mode"));pinMode(5,INPUT);pinMode(4,OUTPUT_OPEN_DRAIN);digitalWrite(4,HIGH);}voidloop(){intpin5=di...
configured with open-drain mode thus easily enablingGPIO interface forI2C data or clock functionalities. Besides that, the chip has pull-up resistance inside which can help save the pull-up resistance outside. As an I2C master, ESP8266EX has waveforms of the SDA and SCL lines simulated ...
I2C_MASTER_SDA_GPIO))) | GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)); //open drain;...
Pin modecan be input (IN), output (OUT) or open-drain (OPEN_DRAIN); Thepullargument is used if we want to activate a pull up or pull down internal resistor (PULL_UP, orPULL_DOWN); Thevaluecorresponds to the GPIO state (if is is on or off): it can be0or1(True or False). ...
GPIO0-GPIO15 can be INPUT, OUTPUT, INPUT_PULLUP, and OUTPUT_OPEN_DRAIN. GPIO16 can be INPUT or OUTPUT. analogRead(0) reads the value of the ADC channel connected to the TOUT pin. Pin interrupts are supported through attachInterrupt, detachInterrupt functions. Interrupts may be attached to an...