← index #4214PR #6146
Off-topic · high · value 0.738
QUERY · ISSUE

ESP32 port missing "hard" kwarg in pin.irq()

openby jedieopened 2018-10-05updated 2025-01-07
enhancementport-esp32

The ESP8266 has hard keyword argument in pin.irq() function. This is missing in ESP32 port.

See also: https://forum.micropython.org/viewtopic.php?p=30748#p30745

CANDIDATE · PULL REQUEST

zephyr: Implement machine.Pin.irq() for setting callbacks on pin change.

mergedby dpgeorgeopened 2020-06-14updated 2020-06-30
port-zephyr

This PR adds support for hard and soft pin interrupts in the zephyr port. In the current implementation, soft interrupt callbacks will only be called when the VM is executing, ie they will not be called during a blocking kernel call like k_msleep. And the behaviour of hard interrupt callbacks will depend on the underlying device, as well as the amount of ISR stack space.

Soft and hard interrupts tested on frdm_k64f and nucleo_f767zi boards.

This will eventually help with testing #6110 and #6125 (uevent and uasyncio)

To test on a frdm_k64f board do:

import machine
usr = machine.Pin(('GPIO_2', 6))
usr.irq(lambda p: print('irq', p), hard=1)

@MaureenHelm FYI

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied