Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

LIS3DH and using DRDY
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

LIS3DH and using DRDY

by dobbz on Tue Sep 01, 2020 9:28 am

Is the correct way to use this feature that was added to the LIS3DH library as follows:
Code: Select all | TOGGLE FULL SIZE
void setup() {
...
lis.enableDRDY();
...
}

void loop() {
...
if (lis.haveNewData()) {
...
  sensors_event_t event;
  lis.getEvent(&event);

...
  }
}


My assumptions are:
1) All required ISRs are handled by the library.
2) The function haveNewData just returns true/false. You still have to retrieve the new data using normal methods.

Thanks!
dobbz
 
Posts: 24
Joined: Wed Mar 12, 2008 11:06 am

Re: LIS3DH and using DRDY

by dastels on Tue Sep 01, 2020 10:14 am

Based on looking at the library source, enabling interrupt(s) simply means that the INT pin on the breakout will generate data ready interrupts which you can then handle. The library does not handle them. The haveNewData() function does a register read to check if data is ready. It's for polling for new data, as opposed to being informed that there is new data via interrupts.

So you'd use one or the other based on your needs.

Dave

dastels
 
Posts: 3819
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.