This is an I2C implementation for mma7660fc-based 3-Axis Digital Accelerometer. It is an embedded-hal driver as part of the weekly driver initiative by Jorge Aparicio.
The Device
The MMA7660FC is a ±1.5 g 3-Axis Accelerometer with Digital Output (I2C). It can be found on Seeed’s Grove 3-Axis Digital Accelerometer. It is made by NXP Semiconductor.
Development
For the development of this driver, I used the Grove 3-Axis Digital Accelerometer and tested on a Raspberry Pi 1 running latest version of Raspbian.
The Driver
It is quite straightforward to use the driver. The documentation provides a comprehensive explanation with an example. Essentially:
Add the mma7660fc crate as a dependency in the
Cargo.toml
file. You also need an implementation forembedded-hal
. For Raspberry Pi, I am using linux-embedded-hal.Initialise the Linux I2C driver and then create an
Mma7660fc
instanceRead the accelerometer values
Conclusion
This is a basic implementation of a driver for mma7660fc-based 3-Axis Digital Accelerometers. The driver does not implement all functionalities. Feedback, suggestions and PR are most welcome.
Resources and Links
Acknowledgement
The structure of this post is based on Danilo Bargen’s weekly driver posts.