I2C ISR help
-
- Posts: 2
- Joined: Mon Apr 29, 2019 12:53 pm
I2C ISR help
Hey! I'm trying to figure out how to setup i2c interrupts with the following function (i2c_isr_register). I am not sure what to put mainly in the arguments, `arg`, `intr_alloc_flags` and `handle`.
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: I2C ISR help
It more-or-less explains it in the image you posted... 'arg' is an opaque pointer to something user-defined. The I2C code does nothing with this, but will pass it through to your ISR handler. If you don't need this, just pass NULL. intr_alloc_flags are flags that define what type of interrupt is used for the I2C code. As it says, look in esp_intr_alloc.h for what you can fill in there. If you don't need it, pass 0. 'handle' is a pointer to an interrupt handle structure; it's used to store information about the interrupt. You'll need it if you later want to disable, re-enable or free the interrupt. Again, if you don't need it, use NULL.
Do note that installing an I2C interrupt also means you have to manually control the I2C hardware; you can't use the API then. Are you sure that is what you want?
Do note that installing an I2C interrupt also means you have to manually control the I2C hardware; you can't use the API then. Are you sure that is what you want?
-
- Posts: 2
- Joined: Mon Apr 29, 2019 12:53 pm
Re: I2C ISR help
I am trying to get it to work as an I2C slave device and this is the only way I got it working.
Now I am using an interrupt on the falling edge of SDA and checking STL to see if I received the start condition.
What I can't figure out is how to have an I2C ISR that also gives access to read/write bit
Now I am using an interrupt on the falling edge of SDA and checking STL to see if I received the start condition.
What I can't figure out is how to have an I2C ISR that also gives access to read/write bit
Who is online
Users browsing this forum: Baidu [Spider], brushlow18, Google [Bot] and 108 guests