adafruit / Adafruit_LSM6DS

Arduino library for LSM6DS
Other
50 stars 41 forks source link

Support Arduino API #21

Closed hathach closed 3 years ago

hathach commented 3 years ago

This PR add Arduino compatible API as https://github.com/arduino-libraries/Arduino_LSM6DSOX/blob/master/src/LSM6DSOX.h#L34

This allow for sketch that run on arduino sensonr/platform can be easily migrated to use with Adafruit Sensor (e.g https://experiments.withgoogle.com/tiny-motion-trainer)

  // Arduino compatible API
  int readAcceleration(float &x, float &y, float &z);
  float accelerationSampleRate(void);
  int accelerationAvailable(void);

  int readGyroscope(float &x, float &y, float &z);
  float gyroscopeSampleRate(void);
  int gyroscopeAvailable(void);

PS: written fashion that requires https://github.com/adafruit/Adafruit_BusIO/pull/46, therefore this is submitted as draft for now

hathach commented 3 years ago

thank you for your review