-
Notifications
You must be signed in to change notification settings - Fork 3.1k
ESP8266 ESP32 Compatibility
Rene K. Mueller edited this page Feb 18, 2018
·
18 revisions
This document reflects conflicts between NodeMCU/ESP8266 and NodeMCU/ESP32 and requirements to achieve larger degree of compatibility:
ESP8266:
- gpio.mode(pin,type,pullup)
- types:
- gpio.INPUT
- gpio.OUTPUT
- gpio.OPENDRAIN
- gpio.INT
- pullup:
- gpio.FLOAT (default)
- gpio.PULLUP enables the weak pull-up resistor
- types:
- gpio.trig(pin,type,callback(level,when))
- types: "up", "down", "both", "low", "high"
ESP32:
-
gpio.config({gpio=..,dir=..,pull=..,opendrain=..})
- dir:
- gpio.IN
- gpio.OUT
- gpio.IN_OUT
- pull:
- gpio.FLOATING disables both pull-up and -down
- gpio.PULL_UP enables pull-up and disables pull-down
- gpio.PULL_DOWN enables pull-down and disables pull-up
- gpio.PULL_UP_DOWN enables both pull-up and -down
- dir:
-
gpio.trig(pin,types,callback(pin,level))
- types:
- gpio.INTR_UP for trigger on rising edge
- gpio.INTR_DOWN for trigger on falling edge
- gpio.INTR_UP_DOWN for trigger on both edges
- gpio.INTR_LOW for trigger on low level
- gpio.INTR_HIGH for trigger on high level
- types:
ESP8266:
- node.info()
- node.chipid() returns an integer (last 3 bytes of the station MAC address)
ESP32:
- node.info() missing
- node.chipid() returns string with '0x' as prefix and 8 bytes whereas the last byte of the MAC address is dropped (risk of 255 identical chipids)
ESP8266:
- tmr.now() microseconds
- tmr.time() time in seconds since boot (uptime)
ESP32:
- tmr.now() missing
- tmr.time() missing
ESP8266 and ESP32 differ a lot: ESP8266
- events are captured via wifi.eventmon.*:
- wifi.eventmon.register(event[, function(T)])
- wifi.eventmon.STA_CONNECTED
- wifi.eventmon.STA_DISCONNECTED
- wifi.eventmon.STA_AUTHMODE_CHANGE
- wifi.eventmon.STA_GOT_IP
- wifi.eventmon.STA_DHCP_TIMEOUT
- wifi.eventmon.AP_STACONNECTED
- wifi.eventmon.AP_STADISCONNECTED
- wifi.eventmon.AP_PROBEREQRECVED
- wifi.eventmon.register(event[, function(T)])
ESP32:
- events are captured via wifi.on()
- wifi.ap.on(event, callback)
- event:
- start: no additional info
- stop: no additional info
- sta_connected: information about the client that connected:
- mac: the MAC address
- id: assigned station id (AID)
- disconnected: information about disconnecting client
- mac: the MAC address
- id: assigned station id (AID)
- probe_req: information about the probing client
- from: MAC address of the probing client
- rssi: Received Signal Strength Indicator value
- event:
- wifi.ap.on(event, callback)