You can chat about native SDK questions and issues here.

User avatar
By HEck
#81171 Hi Community,

I´m using the NONOS_SDK 3.0. When I want to register a ISR for GPIO interrups, I get this error message:

###############################
user_main.c: In function 'user_init':
user_main.c:124:2: error: passing argument 2 of 'ets_isr_attach' from incompatible pointer type [-Werror]
ETS_GPIO_INTR_ATTACH(I2C_Slave_ISR, NULL);
^
In file included from ../../include/os_type.h:28:0,
from ../../include/osapi.h:29,
from user_main.c:26:
../../include/ets_sys.h:67:6: note: expected 'ets_isr_t' but argument is of type 'void (*)(void)'
void ets_isr_attach(int i, ets_isr_t func, void *arg);
^
cc1: all warnings being treated as errors
make[1]: *** [.output/eagle/debug/obj/user_main.o] Error 1
make[1]: Leaving directory `/mnt/Share/ESP8266_NONOS_SDK-3.0/he_i2c_slave/user'
make: *** [.subdirs] Error 2
###############################

What could be wrong? What else must be done, that the compiler can recognize the expected 'ets_isr_t' in "etc_sys.h"?

Thank you for your support
Henry
User avatar
By RichardS
#81175
HEck wrote:###############################
user_main.c: In function 'user_init':
user_main.c:124:2: error: passing argument 2 of 'ets_isr_attach' from incompatible pointer type [-Werror]
ETS_GPIO_INTR_ATTACH(I2C_Slave_ISR, NULL);
^


it expects a pin # not NULL

ETS_GPIO_INTR_ATTACH(interrupt_handler, 12); // GPIO12 interrupt handler function

RichardS
User avatar
By quackmore
#81193 nope

don't think so

ETS_GPIO_INTR_ATTACH expects a function and a function parameter
check out the interrupt function declaration
or try forcing a cast

this is a working example

Code: Select allstatic void input_pulse(struct di_seq *seq);

{
...
struct di_seq *seq;
...
ETS_GPIO_INTR_ATTACH((ets_isr_t)input_pulse, seq);
...
}
User avatar
By HEck
#81198 Hi quackmore and RichardS,

thank you for your responds.

In the end: If I use this

ETS_GPIO_INTR_ATTACH((ets_isr_t)I2C_Slave_ISR, NULL);

then it works. So, the "(ets_isr_t)" declaration for the ISR-argument of the Reg_Function was missing. I could nowhere read such hint (except in yor example). Only the error message from the compiler pointed to this and not to the second argument, which could be a variable for the ISR. But this could also be nothing (NULL) in case no input values are necessary for the ISR. Why the compiler must occupy data space, when not needed.

Greetings
Henry