Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Putting it all together

Let's have a closer look at the digital triaxial acceleration sensor BMA220 from Bosch. This is an SPI/I2C-compatible device, with 8-bit-sized registers, along with an on-chip motion-triggered interrupt controller, which actually senses tilt, motion, and shock vibration. Its data sheet is available at http://www.mouser.fr/pdfdocs/BSTBMA220DS00308.PDF, and its driver has been introduced since kernel v4.8 (CONFIG_BMA200). Let's walk through it.

Firstly, we declare our IIO channels using struct iio_chan_spec. Once the triggered buffer is used, then we need to fill the .scan_index and .scan_type fields:

#define BMA220_DATA_SHIFT 2 #define BMA220_DEVICE_NAME "bma220" #define BMA220_SCALE_AVAILABLE "0.623 1.248 2.491 4.983" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content