These are chat archives for SmingHub/Sming

19th
Apr 2016
iqbaltek
@iqbaltek
Apr 19 2016 15:21
oh thanks for suggestion @hreintke I'll try SmingRTOS later
Patrick Jahns
@patrickjahns
Apr 19 2016 18:52

Hey guys, need a quick help - I am trying to catch an interrupt of a pin. But so far none of the examples worked for me.
It`s GPIO 16 - normal state it is pulled high via an external pullup - and I want it to catch an interrupt when the pin goes low.
The GPIO is working fine - at least when using digitalRead - it clearly reads high/low states

Code sample:

void IRAM_ATTR onClearButton() {
    debugapp("onClearButton");
}

void init() {
attachInterrupt(16, onClearButton, CHANGE);
}

any ideas? am I missing something obvious?

hreintke
@hreintke
Apr 19 2016 21:10

When converting to SminRTOS I've seen a sometimes wrong "translation" from Arduino (=CHANGE) typed interrupts to the espressif type interrupt.

You can try : attachInterrupt(16, onClearButton, (GPIO_INT_TYPE)GPIO_PIN_INTR_ANYEDGE);

typedef enum {
GPIO_PIN_INTR_DISABLE = 0, < disable GPIO interrupt
GPIO_PIN_INTR_POSEDGE = 1, < GPIO interrupt type : rising edge
GPIO_PIN_INTR_NEGEDGE = 2, < GPIO interrupt type : falling edge
GPIO_PIN_INTR_ANYEDGE = 3, < GPIO interrupt type : bothe rising and falling edge
GPIO_PIN_INTR_LOLEVEL = 4, < GPIO interrupt type : low level
GPIO_PIN_INTR_HILEVEL = 5 < GPIO interrupt type : high level
} GPIO_INT_TYPE;

Patrick Jahns
@patrickjahns
Apr 19 2016 21:20
will try - still on NONos ;-)
Patrick Jahns
@patrickjahns
Apr 19 2016 21:44
I tried GPIO_PIN_INTR_ANYEDGE and GPIO_PIN_INTR_LOLEVEL - but no interrupt - is gpio16 not useable with interrupts?
robotiko
@robotiko
Apr 19 2016 21:50
@patrickjahns .. I recall gpio16 doesnt accept interrupts
Or high speed functions
Patrick Jahns
@patrickjahns
Apr 19 2016 21:50
damn
again something learned
robotiko
@robotiko
Apr 19 2016 21:51
I think it is in sdk doc
And also in nodemcu pinout
Patrick Jahns
@patrickjahns
Apr 19 2016 21:53
will have a look again
gota finish for today - again spent 3 hours for debugging -_-