Pin Register names on NodeMCU?

Hello,

For the Arduino, the following code was used to read the state of a pin directly:

byte pinStatus;
pinStatus= PIND >> 3& B00000001; //In PIND register, shift 3 right and check, whether it equals 1

What would be the equivalent on the NodeMCU 1.0? My search for port registers, I/O register names unfortunately came back empty.

Due to speed, I'd like to avoid using digitalRead(my_pin)

But the NodeMCU clocks five times faster than a typical AVR.

Don’t expect any significant difference in speed.
You can either use the GPIP macro or read directly from the GPI register. Note that GPIO16 is special.

See Arduino/core_esp8266_wiring_digital.cpp at f5fd5912fe09d7eec8a909326287379570579ea6 · esp8266/Arduino · GitHub and Arduino/esp8266_peri.h at 36b444dba3b7e46629e9f8e60d4ebdc487d84f4d · esp8266/Arduino · GitHub.

Pieter

Check core_esp8266_wiring_digital.cpp

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.