setup interrupt for I2C_ACK_ERR_INT (ack error)

davdav
Posts: 208
Joined: Thu Nov 17, 2016 2:33 pm

setup interrupt for I2C_ACK_ERR_INT (ack error)

Postby davdav » Fri Apr 13, 2018 12:27 pm

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

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: setup interrupt for I2C_ACK_ERR_INT (ack error)

Postby WiFive » Sat Apr 14, 2018 12:20 am

Driver uses it already https://github.com/espressif/esp-idf/bl ... i2c.c#L232

Usually you will just use 0 for flags.

davdav
Posts: 208
Joined: Thu Nov 17, 2016 2:33 pm

Re: setup interrupt for I2C_ACK_ERR_INT (ack error)

Postby davdav » Sat Apr 14, 2018 7:16 am

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.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: setup interrupt for I2C_ACK_ERR_INT (ack error)

Postby WiFive » Sat Apr 14, 2018 8:19 am

Yes the driver handles those things internally.

Who is online

Users browsing this forum: Google [Bot] and 107 guests