Page 1 of 1

setup interrupt for I2C_ACK_ERR_INT (ack error)

Posted: Fri Apr 13, 2018 12:27 pm
by davdav
I would like to setup the I2C_ACK_ERR_INT interrupt for I2C driver.

Both "i2c_driver_install" and "i2c_isr_register" function require "intr_alloc_flags" but I don't know how to specify it.

I have searched some examples but I didn't found.

Thanks

Re: setup interrupt for I2C_ACK_ERR_INT (ack error)

Posted: Sat Apr 14, 2018 12:20 am
by WiFive
Driver uses it already https://github.com/espressif/esp-idf/bl ... i2c.c#L232

Usually you will just use 0 for flags.

Re: setup interrupt for I2C_ACK_ERR_INT (ack error)

Posted: Sat Apr 14, 2018 7:16 am
by davdav
Thanks @WiFive.

In practice should I rely only on the return value of

Code: Select all

i2c_master_cmd_begin
to get an error of I2C communication? I already did it (I check if return is ESP_FAIL or ESP_ERR_TIMEOUT but my intent was to be informed by the driver immediatly when an ACK is not received.

Re: setup interrupt for I2C_ACK_ERR_INT (ack error)

Posted: Sat Apr 14, 2018 8:19 am
by WiFive
Yes the driver handles those things internally.