Hi,
I have an Imp2 Dev board which has an LIS3DH on board. I want to use an interrupt feature of the LIS3DH IC (orientation detection) that is not implemented in the Electric imp Library for LIS3DH.
I was wondering if any one could point me to an Electric Imp code sample that uses I2C interrupts
I was just about to post with the same answer. I was not reading the ST app note correctly. Thanks for the clarification @Hugo. I am trying to use one interrupt pin for wakeup and non-motion detection as shown in following article
If you look at Fig 2 in the article, the interrupt signal goes high when device is inactive for more than 5 seconds and then goes low when device is in motion. Would it be possible to interrupt this type of interrupt as DIGITAL_IN_WAKEUP and wake up the imp when the signal goes from low to high and high to low.
If you want an interrupt on both edges, you need to use an XOR gate & an RC. See this thread: https://discourse.electricimp.com/discussion/comment/20268/#Comment_20268 - if you want to make this more power efficient, buffer the signal first (so you can use a very weak pullup) before feeding it into the XOR with RC on one leg.
Here’s the low power version, though if you accelerometer has a push-pull output you don’t need the first XOR. Note you will need to connect RS to a GPIO so you can read the current state and RS_TRIGGER to Pin1 for wakeup.
Thanks a lot for the schematic guys. I will look into it. I had another request related to the LIS3DH class. I am looking at the library here and there are no public functions to access register values or write to registers. I want to turn on/off the High Pass Filter as well as look at orientation data.
What is the best way of adding the functions to the existing library and creating a new library for my use.
Right now, you can do a pull request on the lib and if the changes are good then we’d pull them in and publish a new version. Currently, there’s no support for private libs, so you’d just have to pull the modified code into your device code.