Author Topic: Module 120 accelerometer communications  (Read 555 times)

Nick_W

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Re: Module 120 accelerometer communications
« Reply #15 on: December 01, 2016, 07:18:27 am »
Yes it is.

This is one of the things that I was working on. It's quite easy really. First, you can only get a queue of two events (that's the maximum as far as I know), and you can clear them using ClearHardwareEvent.

The way to stop the accelerometer retriggering is to not clear the interrupt register. Sounds simple. Lets take the "autosleep" register for example, every time the accelerometer wakes or goes to sleep it generates an "autosleep" interrupt. You read the "autosleep" register to see if it was a "wake" or "sleep" event.

If you don't read the "autosleep" register, it doesn't clear the interrupt, and no more interrupts will be generated. The same is true for the pulse, click etc. interrupts. You can tell from the interrupt register what interrupt was generated, but if you don't read that specific interrupt, no more will be generated until you do.

In your case, say you have the accelerometer configured to interrupt on pulse. The accelerometer interrupts when it detects a transient, you read the interrupt register and it's a pulse - start the GPS reading - but don't read the pulse register (to find out what axis the pulse was on). No more interrupts until the GPS reports in - then read the pulse register, and the accelerometer will start interrupting again.

This is for the 110 accelerometer module.

The 120 accelerometer is a little different, and the library for that is still in development, but the same principal applies. The 120 module needs a lot more work before it's as easy to control as the 110, and until the battery issue is fixed, I've shelved development.

Hope this helps...