Skip to content

Enable interrupt generation - #14

Open
guiescuissato wants to merge 3 commits into
adafruit:masterfrom
guilherme-escuissato:enable_interrupt
Open

guiescuissato wants to merge 3 commits into
adafruit:masterfrom
guilherme-escuissato:enable_interrupt

Conversation

@guiescuissato

@guiescuissato guiescuissato commented Dec 30, 2021

Copy link
Copy Markdown

Hello! The motivation for me creating this pull request is being able to generate interrupts on a GY-521 board. I basically created 2 functions, to enable and disable interrupt generation:

void enableInterrupt(mpu6050_int_source_t int_source);
void disableInterrupt(mpu6050_int_source_t int_source);

The enum 'mpu6050_int_source_t' specifies which type of interrupt generation source should generate an interrupt, according to register 0x38:

  • FIFO Buffer Overflow Interrupt
  • I2C Master Interrupt
  • Data Ready Interrupt

Since I only required the Data Ready Interrupt for my project, I didn't get to test the FIFO Buffer Overflow Interrupt or the I2C Master Interrupt. But, as I believe you'll agree, their enabling should work well with these functions.

To show you how I intended to use these functions, I also created an example that worked on an Arduino Pro Micro with the GY-521 board. The name of the example is 'interrupt_readings'. To better organize these changes, I did 2 commits, one for editing the library and another for creating the example. (edit: a 3rd to apply clang-format)

I hope you find these changes relevant and valuable! They certainly will be valuable to me, at least ;)

@Nurgak

Nurgak commented Jan 16, 2024

Copy link
Copy Markdown

Can the conflicts be fixed and this PR merged? It contains very useful functionality that is currently missing form the library, notably: trigger the interrupt pin when updated values are available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants